feat: concatenate CommonJS modules with statically analyzable exports - #14933
feat: concatenate CommonJS modules with statically analyzable exports#14933JSerFeng wants to merge 5 commits into
Conversation
📦 Binary Size-limit
❌ Size increased by 8.00KB from 66.74MB to 66.75MB (⬆️0.01%) |
Rsdoctor Bundle Diff Analysis
Found 5 projects in monorepo, 2 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 react-10kPath:
📁 ui-componentsPath:
📦 Download Diff Report: ui-components Bundle Diff 🤖 AI Degradation Analysis (Click to expand)📊 Size ChangesNo significant regressions detected 🎉. (Total bundle delta: +33 bytes / 0.0006%) 🔍 Root Cause Analysis
|
Merging this PR will not alter performance
Comparing Footnotes
|
Deploying rspack with
|
| Latest commit: |
3f2e2e3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://43acc189.rspack-v2.pages.dev |
| Branch Preview URL: | https://codex-concatenate-commonjs-m.rspack-v2.pages.dev |
Summary
optimization.concatenateModules.commonjsoption, which defaults totruewhen module concatenation is enabledexports.x/module.exports.xinto concatenation-scope bindingsreturn, freearguments,delete exports.x, tagged-template call contexts, andexports.__proto__/ Object prototype accessoptimization.concatenateModules.commonjs: falsein modern-module outputThis ports webpack/webpack#21417. It intentionally does not include the IIFE wrapper behavior from webpack/webpack#21436.
Related links
Validation
cargo check -p rspack_plugin_javascript -p rspack_plugin_esm_library -p rspack_plugin_library -p rspack_binding_apicargo test -p rspack --no-runcargo clippy -p rspack_plugin_javascript -p rspack_plugin_esm_library -p rspack_plugin_library -p rspack_binding_api --all-targets -- -D warningscargo fmt --all -- --checkcorepack pnpm run build:cli:devcorepack pnpm run lint:jscorepack pnpm --dir tests/rspack-test run test -t "concatenate-modules/"(50 passed)corepack pnpm exec rstest EsmOutput.test.jsfromtests/rspack-test(486 passed)corepack pnpm exec rstest StatsAPI.test.js -t "with-query"fromtests/rspack-testChecklist