You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Proposal: Update docs about Webpack setting/overwriting process.env.NODE_ENV.
Description
Currently, the example for setting mode in the Webpack config does not mention that setting mode (e.g. using slsw.lib.webpack.isLocal) will overwrite process.env.NODE_ENV. In larger Serverless projects, multiple stages may be specified in serverless.yml. If any serverless function has NODE_ENV set as one of their environment variables, webpack will overwrite it with either production or development.
In many cases, people will likely want to declare env variables in serverless.yml and use Webpack primarily for bundling while still getting the benefits of Webpack's mode.
I suggest updating the docs to mention optimization.nodeEnv, which will tell Webpack not to set process.env.NODE_ENV. It may be useful for people who want their serverless config file as the single source of truth for env variables and don't know that setting mode would, by default, have an impact on them.
If okay for you, I can open a PR with a suggestion.
The text was updated successfully, but these errors were encountered:
Proposal: Update docs about Webpack setting/overwriting process.env.NODE_ENV.
Description
Currently, the example for setting
mode
in the Webpack config does not mention that settingmode
(e.g. usingslsw.lib.webpack.isLocal
) will overwriteprocess.env.NODE_ENV
. In larger Serverless projects, multiple stages may be specified inserverless.yml
. If any serverless function hasNODE_ENV
set as one of their environment variables, webpack will overwrite it with eitherproduction
ordevelopment
.In many cases, people will likely want to declare env variables in
serverless.yml
and use Webpack primarily for bundling while still getting the benefits of Webpack'smode
.I suggest updating the docs to mention optimization.nodeEnv, which will tell Webpack not to set
process.env.NODE_ENV
. It may be useful for people who want their serverless config file as the single source of truth for env variables and don't know that settingmode
would, by default, have an impact on them.If okay for you, I can open a PR with a suggestion.
The text was updated successfully, but these errors were encountered: