rsbuild
rsbuild copied to clipboard
[Bug]: The sideEffects package is not working with namespace import.
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
// 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() // TypeError: window.doSomething is not a function
// index.js with side effect import
import './test.js'
window.doSomething() // It works.
Reproduce link
https://rsbuild.dev/guide/start/quick-start
Reproduce Steps
- execute
rsbuild dev - find the error message in the console