\r\n \u003C/div>\r\n\u003C/template>\r\n\u003Cscript setup>\r\nconst config = useRuntimeConfig();\r\nconsole.log(config);\r\n\u003C/script>\r\n\r\n```\r\n\r\nNow, when I build the project using `yarn build` and then run the production build using `node .output/server/index.mjs`, I get the following output:\r\n\r\n```shell\r\n~/projects/nuxt-starter-ilkcf5 6s\r\n❯ node .output/server/index.mjs\r\nListening http://[::]:3000\r\n{\r\n app: { baseURL: '/', buildAssetsDir: '/_nuxt/', cdnURL: '' },\r\n nitro: { routeRules: { '/__nuxt_error': [Object] }, envPrefix: 'NUXT_' },\r\n public: { apiBaseUrl: '' }\r\n}\r\n```\r\n\r\nNotice that the `config` variable that is getting logged in `app.vue` has a public key of `apiBaseUrl` as `\"\"` as opposed to `http://localhost:8000` as defined in the `.env` file.\r\n\r\nNOTE that this is not an issue when running `yarn dev`.\r\n\r\nJust want to know if this is really a bug or am I missing a step here.\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n```shell\r\n~/projects/nuxt-starter-ilkcf5 6s\r\n❯ node .output/server/index.mjs\r\nListening http://[::]:3000\r\n{\r\n app: { baseURL: '/', buildAssetsDir: '/_nuxt/', cdnURL: '' },\r\n nitro: { routeRules: { '/__nuxt_error': [Object] }, envPrefix: 'NUXT_' },\r\n public: { apiBaseUrl: '' }\r\n}\r\n```\r\n",[2051,2054],{"name":2052,"color":2053},"3.x","29bc7f",{"name":2021,"color":2022},15696,"Environment variables not synced from `.env` file on production build.","2023-01-19T18:20:11Z","https://github.com/nuxt/nuxt/issues/15696",0.6525981,{"description":2061,"labels":2062,"number":2076,"owner":1997,"repository":1997,"state":2012,"title":2077,"updated_at":2078,"url":2079,"score":2080},"### Environment\r\n\r\n------------------------------\r\n- Operating System: Linux\r\n- Node Version: v16.20.0\r\n- Nuxt Version: 3.7.3\r\n- CLI Version: 3.8.4\r\n- Nitro Version: 2.6.3\r\n- Package Manager: npm@9.4.2\r\n- Builder: -\r\n- User Config: devtools, runtimeConfig\r\n- Runtime Modules: -\r\n- Build Modules: -\r\n------------------------------\r\n\r\n### Reproduction\r\n\r\nhttps://stackblitz.com/edit/github-uezcgs?file=nuxt.config.ts\r\n\r\n### Describe the bug\r\n\r\nHint reads:\r\n```\r\nYou can override this value at runtime with NUXT_PUBLIC_A_PP_NAME_S\r\n```\r\n\r\nShould be:\r\n```\r\nYou can override this value at runtime with NUXT_PUBLIC_APP_NAMES\r\n```\r\n\r\n### Additional context\r\n\r\n```ts\r\nexport default defineNuxtConfig({\r\n runtimeConfig: {\r\n public: {\r\n APP_NAMES: 'xyz'\r\n }\r\n }\r\n})\r\n```\r\n\r\nEnvironment variable `NUXT_PUBLIC_APP_NAMES` is properly respected. The issue concerns the documentation exclusively.\r\n\r\n### Logs\r\n\r\n_No response_",[2063,2066,2069,2070,2073],{"name":2064,"color":2065},"good first issue","fbca04",{"name":2067,"color":2068},"types","2875C3",{"name":2052,"color":2053},{"name":2071,"color":2072},"dx","C39D69",{"name":2074,"color":2075},"bug","d73a4a",23246,"RuntimeConfig does not display proper environment variable hint when already using UPPER_SNAKE_CASE","2023-11-15T18:58:02Z","https://github.com/nuxt/nuxt/issues/23246",0.6526681,{"description":2082,"labels":2083,"number":2086,"owner":1997,"repository":1997,"state":2012,"title":2087,"updated_at":2088,"url":2089,"score":2090},"### Environment\r\n\r\nWorking directory: /home/andrey/Documents/nuxt-env-test 4:42:45 PM\r\nNuxt project info: 4:42:45 PM\r\n\r\n------------------------------\r\n- Operating System: Linux\r\n- Node Version: v20.11.0\r\n- Nuxt Version: 3.11.1\r\n- CLI Version: 3.11.1\r\n- Nitro Version: 2.9.5\r\n- Package Manager: pnpm@8.15.5\r\n- Builder: -\r\n- User Config: devtools, runtimeConfig\r\n- Runtime Modules: -\r\n- Build Modules: -\r\n------------------------------\r\n\r\n### Reproduction\r\n\r\nhttps://github.com/4dr1en/repro-nuxt-dynamic-env\r\n\r\nThe .env is included in the repo.\r\n> pnpm run dev\r\n\r\nand\r\n\r\n> pnpm preview\r\n\r\nwork\r\n\r\n> source .env && node .output/server/index.mjs\r\n\r\ndo not\r\n\r\n### Describe the bug\r\n\r\nWhen I follow the official documentation:\r\nhttps://nuxt.com/docs/guide/going-further/runtime-config#example\r\n\r\nThe public runtimeConfig is being replaced by the environements variables in developpement and when doing `pnpm preview`.\r\nBut when the nuxt application is started doing `source .env && node .output/server/index.mjs`, the public runtime configuration is left empty.\r\n\r\n\r\n\r\n### Additional context\r\n\r\nI need to update the runtimeConfiguration using the env variables without rebuilding the app, I tried to follow th official [documentation](https://nuxt.com/docs/guide/going-further/runtime-config#example) but it doesn't work in production.\r\n\r\n.env content\r\n```env\r\nNUXT_PUBLIC_MSG=\"Hello world!\"\r\n```\r\n\r\nnuxt.config.ts\r\n```typescript\r\nexport default defineNuxtConfig({\r\n devtools: { enabled: true },\r\n runtimeConfig: {\r\n public: {\r\n msg: ''\r\n }\r\n }\r\n})\r\n```\r\n\r\napp.vue\r\n```typescript\r\n\u003Cscript lang=\"ts\">\r\n export default defineNuxtComponent({\r\n mounted() {\r\n console.log(this.$config.public.msg)\r\n }\r\n })\r\n\u003C/script>\r\n\r\n\u003Ctemplate>\r\n \u003Cdiv>\r\n {{ $config.public.msg }}\r\n \u003C/div>\r\n\u003C/template>\r\n```\r\n\r\n### Logs\r\ncli\r\n```shell-script\r\n❯ source .env && echo $NUXT_PUBLIC_MSG\r\nHello world!\r\n❯ source .env && node .output/server/index.mjs\r\nListening on http://[::]:3000\r\n```\r\n\r\nbrowser console\r\n```javascript\r\n\u003Cempty string> Mc_nPuuN.js:23:55632\r\n```\r\n\r\nThis is working with `pnpm preview` :\r\n\r\ncli\r\n```shell-script\r\n❯ pnpm preview\r\n\r\n> nuxt-app@ preview /home/andrey/Documents/nuxt-env-test\r\n> nuxt preview\r\n\r\n 5:06:53 PM\r\n ╭────────────────────────────────────────Preview Mode──────────────────────────────────────────╮\r\n │ │\r\n │ You are running Nuxt production build in preview mode. │\r\n │ For production deployments, please directly use node ./server/index.mjs command. │\r\n │ │\r\n │ Node.js: v20.11.0 │\r\n │ Nitro Preset: node-server │\r\n │ Working directory: .output │\r\n │ │\r\n ╰──────────────────────────────────────────────────────────────────────────────────────────────╯\r\n\r\nℹ Loading .env. This will not be loaded when running the server in production. 5:06:53 PM\r\nℹ Starting preview command: node ./server/index.mjs 5:06:53 PM\r\n 5:06:53 PM\r\nListening on http://[::]:3000\r\n```\r\n\r\nbrowser console\r\n```javascript\r\nHello world! [Mc_nPuuN.js:23:55632](http://[::]:3000/_nuxt/Mc_nPuuN.js)\r\n```",[2084,2085],{"name":2052,"color":2053},{"name":2021,"color":2022},26520,"NUXT_PUBLIC_XXX environment variables not overriding public runtimeConfig in production","2024-03-27T16:27:15Z","https://github.com/nuxt/nuxt/issues/26520",0.6542172,{"description":2092,"labels":2093,"number":2096,"owner":1997,"repository":1997,"state":2012,"title":2097,"updated_at":2098,"url":2099,"score":2100},"### Environment\r\n\r\nRootDir: /home/projects/github-qrbpqh 05:30:19\r\nNuxt project info: 05:30:19\r\n\r\n------------------------------\r\n- Operating System: `Linux`\r\n- Node Version: `v16.14.2`\r\n- Nuxt Version: `3.1.1`\r\n- Nitro Version: `2.1.1`\r\n- Package Manager: `npm@7.17.0`\r\n- Builder: `vite`\r\n- User Config: `runtimeConfig`\r\n- Runtime Modules: `-`\r\n- Build Modules: `-`\r\n------------------------------\r\n\r\n### Reproduction\r\n\r\nhttps://stackblitz.com/edit/github-qrbpqh?file=app.vue,nuxt.config.ts\r\n\r\n1. Add a `.env` to the base dir:\r\n\r\n```bash\r\nNUXT_PUBLIC_SITE_URL=\"http://mysite.com\"\r\n```\r\n\r\nRun `npm install && npm run dev`.\r\n\r\nYou see that the `nuxt-simple-sitemap` module, which depends on the `runtimeConfig.public.siteUrl` being defined, throwing an error.\r\n\r\n### Describe the bug\r\n\r\nThe docs say you can write env variables like this:\r\n\r\nhttps://nuxt.com/docs/guide/going-further/runtime-config#environment-variables\r\n\r\n```ts\r\nexport default defineNuxtConfig({\r\n runtimeConfig: {\r\n apiSecret: '', // can be overridden by NUXT_API_SECRET environment variable\r\n public: {\r\n apiBase: '', // can be overridden by NUXT_PUBLIC_API_BASE environment variable\r\n }\r\n },\r\n})\r\n```\r\n\r\nand `.env`\r\n\r\n```\r\nNUXT_API_SECRET=api_secret_token\r\nNUXT_PUBLIC_API_BASE=https://nuxtjs.org\r\n```\r\n\r\nIn the newest nuxt version, this does not work anymore. The string stays empty after build, so the `.env` variables are not injected.\r\n\r\nWhat works is setting it manually like\r\n\r\n```ts\r\nexport default defineNuxtConfig({\r\n runtimeConfig: {\r\n apiSecret: process.env.NUXT_API_SECRET,\r\n public: {\r\n apiBase: process.env.NUXT_PUBLIC_API_BASE,\r\n }\r\n },\r\n})\r\n```\r\n\r\nIf this is by intention, I would add a PR to the docs to make it clear that modules do not have access to the config if you are using the empty-string syntax. Or I think it would actually be even clearer to get rid of that syntax and suggest always use the `process.env.NUXT_...` directly. \r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[2094,2095],{"name":2052,"color":2053},{"name":2021,"color":2022},18692,"[Nuxt 3.1.1] Defining `runtimeConfig.public.myValue = ''` is not injected with `.env` at runtime of a module","2023-02-02T15:16:10Z","https://github.com/nuxt/nuxt/issues/18692",0.65437484,{"description":2102,"labels":2103,"number":2106,"owner":1997,"repository":1997,"state":2012,"title":2107,"updated_at":2108,"url":2109,"score":2110},"### Environment\r\n\r\nNuxt CLI v3.0.0-rc.8 \r\n\r\n------------------------------\r\n- Operating System: `Linux`\r\n- Node Version: `v16.14.2`\r\n- Nuxt Version: `3.0.0-rc.8`\r\n- Package Manager: `npm@7.17.0`\r\n- Builder: `vite`\r\n- User Config: `runtimeConfig`\r\n- Runtime Modules: `-`\r\n- Build Modules: `-`\r\n------------------------------\r\n\r\n### Reproduction\r\n\r\nSample: https://stackblitz.com/edit/github-dnbk4c-y5bqyg?file=package.json,nuxt.config.tsnp\r\nThe config:\r\n```js\r\nexport default defineNuxtConfig({\r\n runtimeConfig: {\r\n public: {\r\n API_HOST: process.env.API_HOST || '',\r\n },\r\n },\r\n});\r\n```\r\n\r\nSteps:\r\n1. yarn build\r\n2. Create a env var via: export API_HOST=\"something\"\r\n3. yarn start\r\n\r\nLook at the console log which prints out the runtime config\r\n\r\n### Describe the bug\r\n\r\nEnvironment variable set after the nuxt build are not being registered in the runtime config\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[2104,2105],{"name":1985,"color":1986},{"name":2052,"color":2053},14721,"Enivornment variables in runtimeConfig not being set at runtime (Nuxt rc.8)","2023-01-19T17:39:20Z","https://github.com/nuxt/nuxt/issues/14721",0.65660316,["Reactive",2112],{},["Set"],["ShallowReactive",2115],{"TRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"C-Y9V81jblZGZ-hcKrkIMIEmdvBBm9OXhs2UFK-5cVA":-1},"/nuxt/nuxt/30605"]