From deedcda4675f78c1d8e31978512a206696749167 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Wed, 26 Feb 2025 03:54:25 +0300 Subject: [PATCH] correctly merge local config when building --- rsbuild.config.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/rsbuild.config.ts b/rsbuild.config.ts index 5fd9316c..4147ce7d 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -34,6 +34,9 @@ if (fs.existsSync('./assets/release.json')) { } const configJson = JSON.parse(fs.readFileSync('./config.json', 'utf8')) +try { + Object.assign(configJson, JSON.parse(fs.readFileSync('./config.local.json', 'utf8'))) +} catch (err) {} if (dev) { configJson.defaultProxy = ':8080' } @@ -105,12 +108,8 @@ const appConfig = defineConfig({ if (fs.existsSync('./assets/release.json')) { fs.copyFileSync('./assets/release.json', './dist/release.json') } - let configLocalJson = {} - try { - configLocalJson = JSON.parse(fs.readFileSync('./config.local.json', 'utf8')) - } catch (err) {} - fs.writeFileSync('./dist/config.json', JSON.stringify({ ...configJson, ...configLocalJson }), 'utf8') + fs.writeFileSync('./dist/config.json', JSON.stringify(configJson), 'utf8') if (fs.existsSync('./generated/sounds.js')) { fs.copyFileSync('./generated/sounds.js', './dist/sounds.js') }