-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add presets to the tree-shaking options #4131
Conversation
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#treeshake-presets or 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.
|
abb32d7
to
ded6187
Compare
ded6187
to
d8ad9ac
Compare
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
,smallest
andrecommended
.The differences are that while
smallest
uses the most aggressive setting everywhere andsafest
uses the most conservative,recommended
will 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.