Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate command will use the cache even if environment variables changed #8199

Closed
clorichel opened this issue Oct 13, 2020 · 0 comments · Fixed by #8200
Closed

Generate command will use the cache even if environment variables changed #8199

clorichel opened this issue Oct 13, 2020 · 0 comments · Fixed by #8200

Comments

@clorichel
Copy link

Versions

  • nuxt: v2.14.5
  • node: v12.18.4

Love words

Thanks for your work on Nuxt ❤️

Reproduction

Additional Details

Steps to reproduce

  1. create a new nuxt project, and use an environment variable in nuxt.config.js, say:
env: {
  apiBaseUrl: process.env.API_BASE_URL || 'http://localhost:3000',
},
  1. generate with API_BASE_URL=somethingYouWantChanged nuxt generate
  2. deploy, play, rince & repeat, then get to a point where you need to change your env var
  3. generate with API_BASE_URL=aNewValue nuxt generate

What is Expected?

context.apiBaseUrl === 'aNewValue'

What is actually happening?

context.apiBaseUrl !== 'aNewValue' because context.apiBaseUrl === 'somethingYouWantChanged'

Bonus

How-To do in the meantime? Just disable the generate cache in nuxt.config.js:

generate: {
  // cache doesn't play well with environment variables that can change!
  cache: false,
},

Thanks pic

ThanksPic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants