question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

runtimeConfig will not be updated after "yarn build"

See original GitHub issue

Environment

  • 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

  1. Create a .env file at the project’s root dir.
  2. Follow the instruction to use the runtimeConfig.
  3. yarn build to build the artifacts.
  4. yarn start to see the current NUXT_ABC value.
  5. Stop or kill the process
  6. Change the value of NUXT_ABC you have set by source .env or NUXT_ABC=123 directly.
  7. 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:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andretwcommented, Sep 1, 2022

@danielroe Thank you, I didn’t realize that there is a convention between them. Thanks a lot!

0reactions
danielroecommented, Aug 31, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found