diff --git a/packages/config/src/load.js b/packages/config/src/load.js index 95f3f436d9..d531ac2f92 100644 --- a/packages/config/src/load.js +++ b/packages/config/src/load.js @@ -177,7 +177,7 @@ function expand (target, source = {}, parse = v => v) { value = interpolate(value) } - return newValue.replace(replacePart, value) + return value !== undefined ? newValue.replace(replacePart, value) : newValue }, value)) } diff --git a/test/fixtures/runtime-config/.env b/test/fixtures/runtime-config/.env index 138fca756f..3bff1d2f7d 100644 --- a/test/fixtures/runtime-config/.env +++ b/test/fixtures/runtime-config/.env @@ -2,3 +2,4 @@ BASE_URL=/api PUBLIC_URL=https://google.com SERVER_BASE_URL API_SECRET=1234 +TOKEN=$2yr$10$tN3JmuvXZKGwi0l38A.SxUVemGrFJiyLunyqkOqOTE7LHsrSwMEmEB diff --git a/test/fixtures/runtime-config/nuxt.config.js b/test/fixtures/runtime-config/nuxt.config.js index a6f7f7c9c1..7bee052b0b 100644 --- a/test/fixtures/runtime-config/nuxt.config.js +++ b/test/fixtures/runtime-config/nuxt.config.js @@ -1,7 +1,8 @@ export default { publicRuntimeConfig: { baseURL: process.env.BASE_URL, - isFixture: true + isFixture: true, + TOKEN: 'default' }, privateRuntimeConfig: { baseURL: '${PUBLIC_URL}${BASE_URL}',