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
feat(generator): add ignoreEnv generate option during ensureBuild(cmd) #8955
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: I think this may be more readble:
const fields = ['nuxtVersion', 'ssr', 'target']
if (nuxt.options.build.ignoreEnv !== true) {
fields.push('env', 'process.env')
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's give it a defualt value false
and update types defination as well.
Thanks for your review @clarkdo. Type definition and default value have been added. Any follow-up on this ? |
Looks good to me, just waiting for other members review. Cc @nuxt/framework |
@@ -0,0 +1,3 @@ | |||
import { buildFixture } from '../../utils/build' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might be missing something, but is this used to test the feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be fully honest I wasn't quite sure if this was the right way to test the feature using the suggested ignoreEnv
option in nuxt.config.js
.
@pi0 We are wondering when can this fix be merged in a minor version ? It will be critical to an imminent release. |
Hi @wlarch sorry for the delayed merge. You can have it (in few minutes) on |
This is wonderful, thanks ! 🌞 |
Types of changes
Description
Added a build option
ignoreEnv
(boolean) to ignoreenv
andprocess.env
fields within the ensureBuild(cmd) quick diff function of the generate.js utils.We are using Nuxt.js to generate multiple static websites with incremental builds. The same Nuxt project (code base) is used for different Websites. The
nuxt generate
command receivesthemeOptions
parameters in our build server thus, changing the environment every time the application needs to achieve a partial build. When the environment changed (env or process.env) webpack needs to rebuild the entire project, this increasesyarn generate
time by +30 seconds (compared to 3 seconds when webpack build is not needed). In our scenario, a webpack rebuild is needed when the code base changes, or Nuxt version, or when--force-build
is specified.Example config :
Another reason this change is needed is because there was no other way to modify the static
cacheDir
prior tonuxt ready
hook. As we edit nuxt.config.js using a custom module, no appropriate hook could be used to edit the'static: { cacheDir }
option.There are no open issues regarding this PR, but it could be related to the one related to single route generation in which I participated in the discussion :
#6138
(More information to come regarding our incremental generation with Nuxt.js).
Checklist:
docs: added documentation for ignoreEnv option website-v2#1323