runtimeConfig will not be updated after "yarn build"
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.17.0
- Nuxt Version:
3.0.0-rc.8
- Package Manager:
yarn@1.22.10
- Builder:
vite
- User Config:
typescript
,head
,runtimeConfig
,modules
,css
,styleResources
,plugins
,components
,experimental
,vite
,hooks
- Runtime Modules:
@nuxtjs/tailwindcss@5.3.2
- Build Modules:
-
Reproduction
- Create a .env file at the project’s root dir.
- Follow the instruction to use the runtimeConfig.
yarn build
to build the artifacts.yarn start
to see the current NUXT_ABC value.- Stop or kill the process
- Change the value of NUXT_ABC you have set by
source .env
or NUXT_ABC=123 directly. yarn start
again and you will see the value hasn’t been changed.
Describe the bug
runtimeConfig does not behave as I expected as a “runtime” config. The configs were set after yarn build
. And you can not change them via any solutions since they were already determined in .output/server/chunks/nitro/node-server.mjs.
Additional context
I want to use the same container image and apply the env configs for every environment by using ‘yarn build’ and yarn start
. Or I can only use yarn dev
and customize the other settings for achieving the goal?
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Why runtimeConfig is not available at runtime? #4637
I was few days hammering my head with why the runtime config is not updated. Until I found this. Then I realize that...
Read more >Why is runtimeConfig doesn't see environment variables in ...
However, after your server is built, you are responsible for setting environment variables when you run the server. Your .env file will not ......
Read more >Why Running `yarn upgrade` Does Not Update My ` ...
My first Google enquiry was yarn upgrade does not update package.json. A few results seemed to be indicating bug in earlier versions of...
Read more >mars/create-react-app-buildpack
Quick Start. Ensure requirements are met, then execute the following in a terminal. ✏️ Replace $APP_NAME with the name for your unique app....
Read more >Handling runtime environment variables in create-react-apps
Let's say you have a .env file in your root already with the following environment variables. NODE_ENV=production REACT_APP_API_URL=https://api.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@danielroe Thank you, I didn’t realize that there is a convention between them. Thanks a lot!
@andretw It should be
NUXT_PUBLIC_MY_ABC
in your case. Also note that you need to have a fallback value or have the variable defined when you build the app.