GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: cjs require destructuring assignment tree shaking by ahabhgk · Pull Request #20548 · webpack/webpack

Conversation

@ahabhgk

@ahabhgk ahabhgk commented Feb 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Support analyze const { a } = require("./m") for cjs tree shaking

What kind of change does this PR introduce?

feat

Did you add tests for your changes?

Yes

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?

None

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alexander-akait, absidue, hai-x, and Gehbt reacted with heart emoji
All reactions
  • ❤️ 4 reactions
@ahabhgk
feat: cjs require destructuring assignment tree shaking
56969e9
@changeset-bot

changeset-bot Bot commented Feb 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 50b5663

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codspeed

codspeed Bot commented Feb 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Merging this PR will degrade performance by 37.67%

⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 123 untouched benchmarks
⏩ 18 skipped benchmarks1

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

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory benchmark "json-modules", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 619.7 KB 994.2 KB -37.67%
❌ Memory benchmark "many-modules-commonjs", scenario '{"name":"mode-production","mode":"production"}' 8 MB 10.3 MB -22.84%
⚡ Memory benchmark "react", scenario '{"name":"mode-development-rebuild","mode":"development","watch":true}' 864.3 KB 645.1 KB +33.98%

Comparing ahabhgk:cjs-tree-shaking-require-destructuring (50b5663) with main (2019127)

Open in CodSpeed

Footnotes

  1. 18 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ahabhgk
fix test
2ba1b7a
alexander-akait
alexander-akait approved these changes Feb 27, 2026
View reviewed changes
@alexander-akait
Create lazy-paws-begin.md
50b5663
@alexander-akait
alexander-akait merged commit 39933d3 into webpack:main Mar 3, 2026
51 of 54 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

This PR is packaged and the instant preview is available (39933d3).

Install it locally:

  • npm
npm i -D webpack@https://pkg.pr.new/webpack@39933d3
  • yarn
yarn add -D webpack@https://pkg.pr.new/webpack@39933d3
  • pnpm
pnpm add -D webpack@https://pkg.pr.new/webpack@39933d3
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Mar 5, 2026
chore(release): new release #20593
Merged
aryanraj45 added a commit to aryanraj45/webpack that referenced this pull request Mar 5, 2026
@aryanraj45
test: add edge case coverage for cjs require destructuring tree shaking
21eb8c2
Adds three missing test assertions for the feature introduced in webpack#20548:

- aliased destructuring ({ a: renamedA }) marks the original key as used
- aliased context require (template literal) same behavior
- default value destructuring ({ a = 'fallback' }) still marks the key as used
- rest element ({ a, ...rest }) bails the analysis, all exports kept
@aryanraj45 aryanraj45 mentioned this pull request Mar 5, 2026
test: add edge case coverage for cjs require destructuring tree shaking #20596
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alexander-akait alexander-akait alexander-akait approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ahabhgk @alexander-akait
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.