Skip to content

Conversation

@LingyuCoder
Copy link
Contributor

Summary

Change the default value of requireAsExpression from true to false. This reduces unnecessary warnings when using require as an expression in most common use cases.

When requireAsExpression is enabled, rspack emits a "Critical dependency" warning whenever require is used as an expression (e.g., var r = require;). By disabling it by default, we avoid these warnings in typical scenarios while still allowing users to opt-in if they need this behavior.

Checklist

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

@netlify
Copy link

netlify bot commented Jan 20, 2026

Deploy Preview for rspack-v2 ready!

Name Link
🔨 Latest commit ca46bc5
🔍 Latest deploy log https://app.netlify.com/projects/rspack-v2/deploys/696ef6ad941c400008c25b1b
😎 Deploy Preview https://deploy-preview-12786--rspack-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: feature release: feature related release(mr only) labels Jan 20, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 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-1k 825.3 KB -
react-5k 2.7 MB -
rome 985.8 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-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.3 KB - -
📄 JavaScript 825.3 KB - -
🎨 CSS 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 - -

📁 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 985.8 KB - -
📄 JavaScript 985.8 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 20, 2026

📦 Binary Size-limit

Comparing ca46bc5 to fix: sort css by sourceorder, esm import comes first (#12778) by Fy

🎉 Size decreased by 322.13KB from 47.99MB to 47.68MB (⬇️0.66%)

@LingyuCoder LingyuCoder force-pushed the feat/disable-require-as-expression-by-default branch from d9c4bae to 1708902 Compare January 20, 2026 03:25
Change the default value of `requireAsExpression` from `true` to `false`.
This reduces unnecessary warnings when using `require` as an expression
in most common use cases.
@LingyuCoder LingyuCoder force-pushed the feat/disable-require-as-expression-by-default branch from 1708902 to ca46bc5 Compare January 20, 2026 03:29
@LingyuCoder LingyuCoder added the release: breaking change release: breaking change related release(mr only) label Jan 20, 2026
@LingyuCoder LingyuCoder changed the title feat(parser): disable requireAsExpression by default feat!: disable requireAsExpression by default Jan 20, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 20, 2026

CodSpeed Performance Report

Merging this PR will degrade performance by 10.75%

Comparing feat/disable-require-as-expression-by-default (ca46bc5) with v2 (7cef317)1

Summary

❌ 1 regressed benchmark
✅ 15 untouched benchmarks
⏩ 1 skipped benchmark2

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
js@external getResolve 1.4 ms 1.6 ms -10.75%

Footnotes

  1. No successful run was found on v2 (679f5d1) during the generation of this report, so 7cef317 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 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.

@chenjiahan chenjiahan merged commit a345710 into v2 Jan 20, 2026
79 of 82 checks passed
@chenjiahan chenjiahan deleted the feat/disable-require-as-expression-by-default branch January 20, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: breaking change release: breaking change related release(mr only) release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants