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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Incorrect tree-shaking during production build when using decorators with webpack #16453
Comments
Hey @Sayan751! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly. If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite. |
This is a terser bug, if I disable optimization it works.
https://try.terser.org/
|
馃捇
How are you using Babel?
babel-loader (webpack)
Input code
Configuration file name
babel.config.json
Configuration
Current and expected behavior
Current behavior
When using the decorator
@bar
on the class, running the production build throws the following error:It seemed that
testVarOne
is tree-shaked.If you remove the decorator usage, then it works fine.
Expected behavior
It works also with decorator.
Environment
System:
- OS: Windows 11 10.0.22635
Binaries:
- Node: 20.9.0 - C:\Program Files\nodejs\node.EXE
- Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
- npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
npmPackages:
- @babel/core: ^7.24.4 => 7.24.4
- @babel/plugin-proposal-decorators: ^7.24.1 => 7.24.1
- babel-loader: ^9.1.3 => 9.1.3
- webpack: ^5.91.0 => 5.91.0
Possible solution
No response
Additional context
Reproduction: https://github.com/Sayan751/babel-webpack-demo
The text was updated successfully, but these errors were encountered: