We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
||
System: OS: macOS 14.4 CPU: (12) arm64 Apple M2 Pro Memory: 81.13 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node Yarn: 1.22.21 - ~/.nvm/versions/node/v18.19.0/bin/yarn npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm pnpm: 8.12.1 - ~/.nvm/versions/node/v18.19.0/bin/pnpm Browsers: Chrome: 126.0.6478.183 Safari: 17.4 npmPackages: @rspack/cli: latest => 0.7.5 @rspack/core: latest => 0.7.5
Writing an expression with two or (||) in it produces incorrect bundle output.
Source:
el.innerHTML = 'hello, world' || undefined || undefined
Webpack output (correct):
el.innerHTML = 'hello, world' || 0 || 0
Rspack output (incorrect):
el.innerHTML = true || 0
Another example:
// Config new rspack.DefinePlugin({ 'process.env.GIT_COMMIT': JSON.stringify('commit-sha'), }) // App const GIT_COMMIT = process.env.GIT_COMMIT || process.env.ISC_SHA || process.env.BUILD_SHA // Result const GIT_COMMIT = true || 0
We noticed this when upgrading from 0.6.2 to 0.7.5.
https://github.com/bostondv/rspack-repro/tree/or-expr
npm run build
The text was updated successfully, but these errors were encountered:
truthy || any
falsy && any
xc2
Successfully merging a pull request may close this issue.
System Info
System:
OS: macOS 14.4
CPU: (12) arm64 Apple M2 Pro
Memory: 81.13 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v18.19.0/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
pnpm: 8.12.1 - ~/.nvm/versions/node/v18.19.0/bin/pnpm
Browsers:
Chrome: 126.0.6478.183
Safari: 17.4
npmPackages:
@rspack/cli: latest => 0.7.5
@rspack/core: latest => 0.7.5
Details
Writing an expression with two or (
||
) in it produces incorrect bundle output.Source:
Webpack output (correct):
Rspack output (incorrect):
Another example:
We noticed this when upgrading from 0.6.2 to 0.7.5.
Reproduce link
https://github.com/bostondv/rspack-repro/tree/or-expr
Reproduce Steps
npm run build
The text was updated successfully, but these errors were encountered: