-
Notifications
You must be signed in to change notification settings - Fork 156
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: The sideEffects package is not working with namespace import. #2859
Comments
investigation👍🏻 I used Rsdoctor loader analysis to debug this issue and it is awesome !!! It was observed that the swc-loader with transform deleted the unused If you use swc-loader or babel-loader with webpack/Rspack, you will encounter the same issue. I haven't found an option to keep them at present |
webpack + babel-loader works fine. webpack + swc-loader works the same. |
Sorry, some information was ignored, based on "preset-typescript" |
I tested the effects of using Webpack with several different loaders. // test.js
export const doSomething = () => {
console.log('It works.')
}
window.doSomething = doSomething // index.js with namespace import
import * as something from './test.js'
window.doSomething() // index.ts with namespace import
import * as something from './test.js'
(window as any).doSomething() Results:
Based on the tests above, it can be observed that when transforming Unfortunately, in real-world projects, it is common to encounter a mix of TypeScript and JavaScript. |
Version
Browsers: Chrome: 126.0.6478.127 Edge: Chromium (126.0.2592.87) npmPackages: @rsbuild/core: 1.0.0-alpha.6 => 1.0.0-alpha.6
Details
Reproduce link
https://rsbuild.dev/guide/start/quick-start
Reproduce Steps
rsbuild dev
The text was updated successfully, but these errors were encountered: