feat: add pureFunctions javascript parser option#21063
Conversation
🦋 Changeset detectedLatest commit: d3a577c 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 |
eb63763 to
c6da2c7
Compare
|
This PR is packaged and the instant preview is available (7418c36). Install it locally:
npm i -D webpack@https://pkg.pr.new/webpack@7418c36
yarn add -D webpack@https://pkg.pr.new/webpack@7418c36
pnpm add -D webpack@https://pkg.pr.new/webpack@7418c36 |
| usedExportsOfPureSource | ||
| } from "./pure-source"; | ||
|
|
||
| const usePureFn = pureFn(1); |
| } from "./pure-source"; | ||
|
|
||
| const usePureFn = pureFn(1); | ||
| const usePureArrow = pureArrow(1); |
|
|
||
| const usePureFn = pureFn(1); | ||
| const usePureArrow = pureArrow(1); | ||
| const usePureDefault = pureDefault(1); |
| const usePureArrow = pureArrow(1); | ||
| const usePureDefault = pureDefault(1); | ||
|
|
||
| const useImpure = impureExport(2); |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #21063 +/- ##
==========================================
+ Coverage 91.73% 91.74% +0.01%
==========================================
Files 581 581
Lines 60657 60686 +29
Branches 16407 16428 +21
==========================================
+ Hits 55641 55678 +37
+ Misses 5016 5008 -8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Merging this PR will improve performance by 36.44%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Summary
What kind of change does this PR introduce?
Adds
module.parser.javascript.pureFunctions, an array of top-level function names to treat as side-effect-free for pure-function-based tree shaking.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?
Document the new
module.parser.javascript.pureFunctionsoption onwebpack.js.org (Module →
module.parser).Use of AI
Partial