feat!: revert enable verbatimModuleSyntax#12846
Conversation
verbatimModuleSyntax of builtin:swc-loader …There was a problem hiding this comment.
Pull request overview
This PR reverts the previous change that enabled verbatimModuleSyntax by default in builtin:swc-loader, aligning behavior, tests, and documentation back with the non‑verbatim default.
Changes:
- Remove English and Chinese documentation that stated
builtin:swc-loaderenablesverbatimModuleSyntaxby default and showed how to turn it off. - Remove the
tests/rspack-test/configCases/builtin-swc-loader/verbatim-module-syntaxintegration test case and its associated TS/JS files and README that validated the defaultverbatimModuleSyntax: truebehavior. - Adjust
SwcLoader’s transform setup to stop forcingverbatim_module_syntax = trueand to only merge aTransformConfig(settingreact.development) when ajsc.transformconfig is already present.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/docs/en/guide/features/builtin-swc-loader.mdx | Removes the tip describing verbatimModuleSyntax as enabled by default and how to disable it, so docs no longer claim that behavior. |
| website/docs/zh/guide/features/builtin-swc-loader.mdx | Chinese docs updated in the same way, removing the default-verbatimModuleSyntax tip and example. |
| tests/rspack-test/configCases/builtin-swc-loader/verbatim-module-syntax/types.ts | Deletes test‑only TypeScript types used to verify that type‑only imports are erased under default verbatimModuleSyntax. |
| tests/rspack-test/configCases/builtin-swc-loader/verbatim-module-syntax/lib.ts | Deletes the TS helper module that imported the test types and exposed runtime values to assert the behavior of verbatimModuleSyntax. |
| tests/rspack-test/configCases/builtin-swc-loader/verbatim-module-syntax/index.js | Removes the Jest/Mocha-style test that asserted verbatimModuleSyntax: true was enabled by default. |
| tests/rspack-test/configCases/builtin-swc-loader/verbatim-module-syntax/rspack.config.js | Removes the dedicated Rspack config used to run the verbatim module syntax test case. |
| tests/rspack-test/configCases/builtin-swc-loader/verbatim-module-syntax/README.md | Deletes README documenting what verbatimModuleSyntax does and the expectations of the now-removed test case. |
| crates/rspack_loader_swc/src/lib.rs | Stops forcing transform.verbatim_module_syntax = true in SwcLoader and changes the merge logic so that a default TransformConfig (with react.development set) is only merged when config.jsc.transform is already present, altering behavior beyond just the verbatimModuleSyntax default. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f36aa578aa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Rsdoctor Bundle Diff Analysis
Found 5 projects in monorepo, 3 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 react-10kPath:
📦 Download Diff Report: react-10k Bundle Diff 📁 react-5kPath:
📦 Download Diff Report: react-5k Bundle Diff 📁 romePath:
📦 Download Diff Report: rome Bundle Diff Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
🙈 Size remains the same at 48.33MB |
Deploying rspack with
|
| Latest commit: |
f36aa57
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://220c02a9.rspack-v2.pages.dev |
| Branch Preview URL: | https://yj-revert-verbatim.rspack-v2.pages.dev |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
Summary
Reverts #12668
setting verbatimModuleSyntax to true will cause huge performance regression caused by build unnecessary modules(which is removed by verbatimModuleSyntax) for some cases. so consider revert it back to false
Related links
Checklist