Highlights 💡
Improved Tree Shaking for Dynamic Import .then()
This release enhances tree shaking capabilities specifically for the .then()
callbacks of dynamic imports. Rspack can now statically analyze and eliminate unused exports when destructuring is performed on the resolved module within promise chains:
// Tree shaking now works for destructuring in .then() callbacks
import('./utils').then(module => {
const { usedFunction } = module; // Only usedFunction will be included
usedFunction();
// unusedFunction will be tree-shaken out
});
JSX Preserve Support
Rspack now supports parsing and preserving JSX syntax. This allows JSX syntax to be parsed without transformation, making it compatible with external JSX transformers.
// rspack.config.js
export default {
module: {
parser: {
javascript: {
jsx: true // Enable JSX parsing
}
},
rules: [
{
test: /\.jsx?$/,
use: {
loader: 'swc-loader',
options: {
jsc: {
parser: { jsx: true },
transform: {
// Preserve JSX syntax
react: { runtime: 'preserve' }
}
}
}
}
}
]
}
};
What's Changed
New Features 🎉
- feat: static analyze destructuring assignment dynamic import variable for tree shaking by @ahabhgk in #11731
- feat: parser support jsx by @fi3ework in #11664
Bug Fixes 🐞
- fix: correct infrastructureLog type and add documentation by @chenjiahan in #11742
- fix: inline enum not only properties used by @ahabhgk in #11740
- fix: mf should correctly hoist modules by @ahabhgk in #11743
Document Updates 📖
- docs: improve Web Workers documentation with more details by @chenjiahan in #11737
Other Changes
- test: refactor processor by @LingyuCoder in #11732
- test: rename config files by @LingyuCoder in #11733
- test: remove processor by @LingyuCoder in #11738
- test: remove runner factory by @LingyuCoder in #11741
- chore(deps): update github-actions by @renovate[bot] in #11746
- chore(deps): update patch npm dependencies by @renovate[bot] in #11680
Full Changelog: v1.5.6...v1.5.7