Skip to content
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

chore(package.json): add sideEffects: false field to package.json #1253

Closed

Conversation

TheLarkInn
Copy link

@TheLarkInn TheLarkInn commented Apr 28, 2018

This PR adds the "sideEffects": false property in vuex's package.json file. This allow's webpack (for those who want to opt-in to requiring vuex's original source files (instead of the flattened esm bundles), then this will allow webpack to aggressively ignore and treeshake unused exports throughout the module system.

In many cases this can yield hidden and surprising build time improvements and size reductions in the case that modules flattened from rollup aren't actually needed when webpack performs a scope analysis.

The angular team has adopted this approach for the CLI yielding some strong build time speed for webpack (since unused exports are also not resolved, parsed, etc.). From my assessment of the module graph created, it looks that there are no sideEffects created against existing re-exports throughout the codebase, therefore even if a user did opt in on their own will, and remove flow types, there should be no danger of removing code that is needed and causing breakages.

Overall, this already will not be a breaking change in any way but just provides extra benefits to those (and for the cli (if realized) when using webpack 4 and mode: production). Users would still have to explicitly alias vuex (as it shows in your examples folder to realize these build speed and size wins).

Happy to answer any other questions.
~Sean + webpack team

Related: vuejs/vue#8099

Copy link
Member

@ktsn ktsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Can we revert the changes under dist directory since it should be only updated on release?

@kiaking
Copy link
Member

kiaking commented Apr 21, 2020

@TheLarkInn Can you remove the dist folder from the commit? Or I'll take over this PR. "sideEffects": false is already applied on Vuex 4, so I think it can be merged into Vuex 3 as well.

@kiaking kiaking added the build Related to the build system label Apr 21, 2020
@ktsn ktsn closed this in #1729 Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to the build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants