Skip to content

perf: skip source map composition for a single minimizer - #746

Open
hai-x wants to merge 1 commit into
mainfrom
perf/single-minimizer-source-map
Open

hai-x wants to merge 1 commit into
mainfrom
perf/single-minimizer-source-map

Conversation

@hai-x

@hai-x hai-x commented Sep 22, 2026

Copy link
Copy Markdown
Member

Summary

With a single minimizer the plugin composed its map with the input map, then handed both to webpack's SourceMapSource, which composes that same level again, so every mapped asset paid for a redundant decode and re-encode of its map.

The minimizer's map is now used as returned and composition is left to SourceMapSource; a chain of minimizers still composes between steps.

What kind of change does this PR introduce?

perf

Did you add tests for your changes?

No

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

Yes

Summary by CodeRabbit

  • Bug Fixes
    • Improved source map handling when exactly one minimizer is configured, preserving the minimizer’s source map directly.
    • Source map composition continues to be used when multiple minimizers are configured.

@changeset-bot

changeset-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3e4ac54

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: a20eee9f-ad4b-4053-ab2a-46b833b39cdc

📥 Commits

Reviewing files that changed from the base of the PR and between c8c4bf2 and 3e4ac54.

📒 Files selected for processing (1)
  • src/minify.js

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

minify now preserves the returned source map when exactly one minimizer runs. It continues to compose source maps when multiple minimizers run.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 3e4ac

The plugin now preserves a single minimizer’s source map while retaining composition for chains; no merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main performance improvement: skipping source map composition when exactly one minimizer is configured.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/minify.js

ESLint failed to execute (timeout).


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.95%. Comparing base (c8c4bf2) to head (3e4ac54).

❗ There is a different number of reports uploaded between BASE (c8c4bf2) and HEAD (3e4ac54). Click for more details.

HEAD has 9 uploads less than BASE
Flag BASE (c8c4bf2) HEAD (3e4ac54)
24 15
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #746      +/-   ##
==========================================
- Coverage   97.79%   87.95%   -9.84%     
==========================================
  Files           5        5              
  Lines        1634     1636       +2     
  Branches      620      622       +2     
==========================================
- Hits         1598     1439     -159     
- Misses         36      157     +121     
- Partials        0       40      +40     

☔ View full report in Codecov by Harness.
📢 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.

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.

1 participant