Add presets to the tree-shaking options#4131
Merged
Merged
Conversation
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#treeshake-presetsor load it into the REPL: |
02a7e15 to
abb32d7
Compare
Codecov Report
@@ Coverage Diff @@
## master #4131 +/- ##
=======================================
Coverage 98.12% 98.13%
=======================================
Files 201 201
Lines 7090 7114 +24
Branches 2074 2081 +7
=======================================
+ Hits 6957 6981 +24
Misses 64 64
Partials 69 69
Continue to review full report at Codecov.
|
9 tasks
abb32d7 to
ded6187
Compare
ded6187 to
d8ad9ac
Compare
alicewriteswrongs
added a commit
to stenciljs/core
that referenced
this pull request
Dec 7, 2022
14 tasks
alicewriteswrongs
added a commit
to stenciljs/core
that referenced
this pull request
Jan 12, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
As the number of tree shaking options is growing, this will provide the user to additionally choose from three presets:
safest,smallestandrecommended.The differences are that while
smallestuses the most aggressive setting everywhere andsafestuses the most conservative,recommendedwill be conservative on most settings but may swallow some syntactic errors. At the moment, it will swallow errors from accessing unknown global variables, but in the future this may extend to accessing const/let variables before they are initialized.You can use if like this:
There is also an object form that allows using a preset while overriding some values:
From the CLI, you use it like this
Using a preset from the CLI will of course override any values in the config file.