feat: set sideEffects to false in package.json #262
Merged
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 sets
sideEffects
to false to improve the builds for the users.What does it do?
Some informations can be found here. In our case it will only prevent Planck from being included in the bundle if its not used (and maybe some other minor optimisations from the bundler)
So yes, pretty minor thing, but also only a pretty minor change. I am currently indeed actively overriding this setting to
false
in a webpack config.Is it Webpack specific?
No, even though most of the documentation you see online is for Webpack, also tools like Vite are using it.
How to test it?
You can test the change by making a simple build setup:
Create a file
src/index.js
with the code given above (you can also use.ts
for vite. For webpack you would have to add a webpack config to configure ts-loader). To test vite you also have to create aindex.html
at the root that includes this script tag:<script src="src/index.js" type="module"></script>
. Then runor
and check the generated js file in the
dist
folder.You can edit
node_modules/planck/package.json
directly to see how it changes the generated code.