Closed hzy closed 3 weeks ago
This is the same behavior as TypeScript, you can preserve import statement using this configuration
This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
System Info
System: OS: macOS 14.1.1 CPU: (10) arm64 Apple M1 Max Memory: 149.39 MB / 64.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.20.4 - ~/.nvm/versions/node/v18.20.4/bin/node npm: 10.7.0 - ~/.nvm/versions/node/v18.20.4/bin/npm pnpm: 7.33.6 - ~/.nvm/versions/node/v18.20.4/bin/pnpm bun: 1.1.4 - ~/.bun/bin/bun Browsers: Chrome: 127.0.6533.101 Safari: 17.1
Details
A module is import but not none of its exports is used, in rspack this import is removed by
builtin:swc-loader
, causing the side effect statement of the import is not executed.If i create a project with cra with same code, the side effect statement of the import is executed.
Below is a screenshot of rsdoctor loader analysis:
Reproduce link
No response
Reproduce Steps
sideEffect.js
with content below: