Skip to content

Make const reassignments only a warning #6020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2025
Merged

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description

While I still think it is useful to detect const reassignments, I agree that it might be enough to warn about these cases and still emit a bundle. After all in browsers, const reassignments are no parse error but runtime errors, so issues in unused code or within try-catch can still be handled.

Copy link

vercel bot commented Jul 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2025 11:28am

Copy link

github-actions bot commented Jul 19, 2025

Thank you for your contribution! ❤️

You can try out this pull request locally by installing Rollup via

npm install rollup/rollup#gh-6018_const_reassign

Notice: Ensure you have installed the latest stable Rust toolchain. If you haven't installed it yet, please see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust.

or load it into the REPL:
https://rollup-hnlhm1948-rollup-js.vercel.app/repl/?pr=6020

Copy link

github-actions bot commented Jul 19, 2025

Performance report

  • BUILD: 7027ms, 818 MB
    • initialize: 0ms, 24.7 MB
    • generate module graph: 2615ms, 628 MB
      • generate ast: 1366ms, 618 MB
    • sort and bind modules: 402ms, 682 MB
    • mark included statements: 4008ms, 818 MB
      • treeshaking pass 1: 2347ms, 816 MB
      • treeshaking pass 2: 470ms, 848 MB
      • treeshaking pass 3: 404ms, 820 MB
      • treeshaking pass 4: 390ms, 851 MB
      • treeshaking pass 5: 388ms, 818 MB
  • GENERATE: 993ms, 924 MB
    • initialize render: 0ms, 945 MB (+4%)
    • generate chunks: 143ms (+94ms, +191.5%), 904 MB (-3%)
      • optimize chunks: 0ms, 929 MB
    • render chunks: 740ms (-106ms, -12.5%), 905 MB
    • transform chunks: 20ms, 924 MB
    • generate bundle: 0ms, 924 MB

Copy link

codecov bot commented Jul 19, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 21.74%. Comparing base (71a0bf3) to head (500b842).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/ast/nodes/AssignmentExpression.ts 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6020       +/-   ##
===========================================
- Coverage   98.79%   21.74%   -77.06%     
===========================================
  Files         270      259       -11     
  Lines       10575    10214      -361     
  Branches     2821     2733       -88     
===========================================
- Hits        10448     2221     -8227     
- Misses         87     7820     +7733     
- Partials       40      173      +133     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lukastaegert lukastaegert merged commit c84af17 into master Jul 26, 2025
40 of 42 checks passed
@lukastaegert lukastaegert deleted the gh-6018_const_reassign branch July 26, 2025 05:31
Copy link

This PR has been released as part of rollup@4.45.3. You can test it via npm install rollup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rollback breaking change: "const reassign rule" that was introduced as a non-breaking change
1 participant