feat: cjs require destructuring assignment tree shaking#20548
feat: cjs require destructuring assignment tree shaking#20548alexander-akait merged 3 commits intowebpack:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 50b5663 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Merging this PR will degrade performance by 37.67%
Performance Changes
Comparing Footnotes
|
|
This PR is packaged and the instant preview is available (39933d3). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@39933d3
yarn add -D webpack@https://pkg.pr.new/webpack@39933d3
pnpm add -D webpack@https://pkg.pr.new/webpack@39933d3 |
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
Summary
Support analyze
const { a } = require("./m")for cjs tree shakingWhat 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