refactor!: drop CommonJS build and transition to pure ESM package#12733
refactor!: drop CommonJS build and transition to pure ESM package#12733Timeless0911 merged 4 commits intov2from
Conversation
✅ Deploy Preview for rspack-v2 canceled.
|
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 5 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 react-10kPath:
📁 react-5kPath:
📁 react-1kPath:
📁 romePath:
📁 ui-componentsPath:
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🎉 Size decreased by 471.25KB from 48.03MB to 47.57MB (⬇️0.96%) |
Merging this PR will not alter performance
Comparing Footnotes
|
chenjiahan
left a comment
There was a problem hiding this comment.
This PR should be broken down into 2-3 smaller PRs.
dc39714 to
4250442
Compare
dfc014a to
b1bc0fe
Compare
b1bc0fe to
1f54d69
Compare
Summary
@rspack/coreand@rspack/cliis now published as a pure ESM package, and its CommonJS build output has been removed.In Node.js v20.19.0 and later, the runtime natively supports loading ESM modules via
require(). As a result, for most projects that use Rspack through its JavaScript API, this change should have no practical impact and does not require any code modifications.While we have ensured full compatibility for native Node.js usage, please note that tooling environments (such as TypeScript, test frameworks, or bundlers) might encounter breaking changes if you import
@rspack/coreusing import syntax in an CommonJS project (type: "module" not set) before. You may need to adjust your code usage,tsconfig.json, or the configurations of your build/test tools to accommodate this change.module.hothas been replaced byimport.meta.webpackHotandhot/*.jsrecommend to use named export in Rspack 2.0.tests has been updated to compatible with pure esm transition
TODO
@rspack/browserhas not been refactored which will be done in later PRhot/*.jsRelated links
Checklist