Repository navigation
fix(javascript): leave the enclose wrapper's unnamed source out of the minifier's source map - #22654
Conversation
…e minifier's source map terser adds a null entry to sources for the wrapper enclose parses from no file, which no mapping references and which Rollup rejects (terser#1333).
…ee printer drops Same change as #22649, which main needs for the syntax-printer suite to pass.
|
| Name | Type |
|---|---|
| webpack | Patch |
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 6 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Types CoverageCoverage after merging fix/minifier-enclose-source-map-null-source into main will be
Coverage Report |
|
This PR is packaged and the instant preview is available (a4394b4). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@a4394b4
yarn add -D webpack@https://pkg.pr.new/webpack@a4394b4
pnpm add -D webpack@https://pkg.pr.new/webpack@a4394b4 |
Generated code sizeComparing base (
Read No asset changed size. No runtime gained or lost a runtime module. Built |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22654 +/- ##
==========================================
+ Coverage 96.28% 96.31% +0.03%
==========================================
Files 774 774
Lines 130216 131990 +1774
Branches 43417 44091 +674
==========================================
+ Hits 125376 127128 +1752
- Misses 4840 4862 +22
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
With
encloseand a source map, the minifier (like terser, terser/terser#1333) writesnullintosourcesfor the wrapper it parses from no file. No mapping points at it, and Rollup rejects the map. The source map builder now skips a source-less node when registering source content, gated on the minifier's corrections.The second commit is the 2-line fix from #22649, ported because
maincurrently failsshould keep the comments of an empty statement it drops. It drops out on rebase once #22649 lands.This came out of re-checking the terser issues that had no runnable input; the rest of that batch did not reproduce in webpack.
What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes,
test/unitCases/syntax-printer.unittest.js(corrected map, plus terser's map with corrections off).Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Claude Code probed the unverifiable terser issues against webpack's minifier, wrote the test and fix, and ran the tests and lint; the change was reviewed against terser's output.
🤖 Generated with Claude Code
https://claude.ai/code/session_01DkbKQExLB5DCjMf3nUMvtX
Generated by Claude Code