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
In webpack there's an option that you can use to disable nodeEnvoptimization. Setting it to false doesn't seem to do anything in rspack (it is still replaced and optimization is on), although it is supposed to avoid replacing NODE_ENV variable. I didn't find any plausible way to avoid process.env.NODE_ENV from overwriting by the bundler.
optimization: {nodeEnv: false,},
Reproduce link
No response
Reproduce Steps
Create any starter project
Set optimization.nodeEnv to false and use console.log(process.env.NODE_ENV) in the file
Build project in production/development mode, doesn't matter
NODE_ENV is overwritten in the output file
The text was updated successfully, but these errors were encountered:
This is the compatible coded in the early days when the optimization.nodeEnv was not supported, and now it should be deleted. But because the deletion will cause a breaking change, we will remove it in 0.7.0.
This is the compatible coded in the early days when the optimization.nodeEnv was not supported, and now it should be deleted. But because the deletion will cause a breaking change, we will remove it in 0.7.0.
Okay great, if you delete it would that mean that NODE_ENV wouldn't be replaced by default (and you'd need to use a DefinePlugin for that), or is there a different option in config that handles replacing NODE_ENV?
Only woke up at the moment, so if I'm getting this correctly this PR means that optimizations.nodeEnv would work as expected.
System Info
System:
OS: macOS 14.3.1
CPU: (12) arm64 Apple M2 Pro
Memory: 79.41 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
Yarn: 4.1.1 - /opt/homebrew/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
pnpm: 8.15.4 - ~/Library/pnpm/pnpm
bun: 1.1.3 - ~/.bun/bin/bun
Browsers:
Chrome: 123.0.6312.107
Safari: 17.3.1
Details
In webpack there's an option that you can use to disable
nodeEnv
optimization. Setting it to false doesn't seem to do anything in rspack (it is still replaced and optimization is on), although it is supposed to avoid replacing NODE_ENV variable. I didn't find any plausible way to avoid process.env.NODE_ENV from overwriting by the bundler.Reproduce link
No response
Reproduce Steps
optimization.nodeEnv
to false and useconsole.log(process.env.NODE_ENV)
in the fileThe text was updated successfully, but these errors were encountered: