Skip to content

Conversation

@Timeless0911
Copy link
Contributor

@Timeless0911 Timeless0911 commented Jan 14, 2026

Summary

  • @rspack/core and @rspack/cli is 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/core using 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.hot has been replaced by import.meta.webpackHot and hot/*.js recommend to use named export in Rspack 2.0.

  • tests has been updated to compatible with pure esm transition

TODO

  • @rspack/browser has not been refactored which will be done in later PR
  • Remove default export in hot/*.js

Related links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link

netlify bot commented Jan 14, 2026

Deploy Preview for rspack-v2 canceled.

Name Link
🔨 Latest commit 7809a0d
🔍 Latest deploy log https://app.netlify.com/projects/rspack-v2/deploys/6968dd44c2f93e000821c57d

@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Jan 14, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB -
react-5k 2.7 MB -
react-1k 825.4 KB -
rome 986.0 KB -
ui-components 2.1 MB -
📋 Detailed Reports (Click to expand)

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.7 MB - -
📄 JavaScript 5.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 825.4 KB - -
📄 JavaScript 825.4 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 986.0 KB - -
📄 JavaScript 986.0 KB - -
🎨 CSS 0 B - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.1 MB - -
📄 JavaScript 2.0 MB - -
🎨 CSS 83.0 KB - -
🌐 HTML 0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Jan 14, 2026

📦 Binary Size-limit

Comparing 7809a0d to chore(lint): bump @rslint/core to 0.2.0 and enable default-param-last rule (#12746) by senze.fan

🎉 Size decreased by 471.25KB from 48.03MB to 47.57MB (⬇️0.96%)

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 14, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing pure-esm (7809a0d) with v2 (a0a802b)2

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

  2. No successful run was found on v2 (9fca97e) during the generation of this report, so a0a802b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR should be broken down into 2-3 smaller PRs.

@Timeless0911 Timeless0911 changed the title refactor!: drop CommonJS build and drop support for Node 18 refactor!: drop CommonJS build and transition to pure ESM package Jan 15, 2026
@Timeless0911 Timeless0911 marked this pull request as draft January 15, 2026 03:31
@Timeless0911 Timeless0911 force-pushed the pure-esm branch 3 times, most recently from dfc014a to b1bc0fe Compare January 15, 2026 09:34
@Timeless0911 Timeless0911 marked this pull request as ready for review January 15, 2026 10:04
@Timeless0911 Timeless0911 merged commit 4a600d1 into v2 Jan 15, 2026
53 checks passed
@Timeless0911 Timeless0911 deleted the pure-esm branch January 15, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: refactor team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants