Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upchore(package.json): Add sideEffects: false field in package.json #8099
Conversation
This PR adds the sideEffects: false property in vue's package.json file. This allow's webpack (for those who want to opt in to requiring vue's original source files (instead of the flattened
This comment has been minimized.
This comment has been minimized.
lukepolo
commented
May 17, 2018
|
This is awesome thanks for this! |
This comment has been minimized.
This comment has been minimized.
silltho
commented
Jun 18, 2018
|
Hy Sean! Could you please specify what you mean by "vue's original source files"? I looked at the index.js file in the src/core folder and to my knowledge there are plenty sideeffects that would be prune away by tree shaking. (e.g Object.defineProperty) I hope you can help me understand how this works. |
This comment has been minimized.
This comment has been minimized.
|
Everything can be answered here for you. side effects doesn't mean the same as it does exactly in functional programming. https://stackoverflow.com/questions/49160752/what-does-webpack-4-expect-from-a-package-with-sideeffects-false |
* vuejs-dev: (558 commits) chore: sponsors chore: update sponsors chore: update sponsors chore: sponsor cleanup chore: update sponsors chore(package.json): Add sideEffects: false field in package.json (vuejs#8099) chore: new sponsor chore(typo): no dots at the end of the comments (vuejs#8087) chore: new sponsor chore: update sponsors chore: update sponsors chore: use reactive components count in benchmark (vuejs#7996) feat(weex): support object syntax of class (vuejs#7930) feat(server, webpack-plugin): webpack 4 support (vuejs#7839) fix(ssr): render initial and used async css chunks (vuejs#7902) fix(ssr): remove trailing hash in webpack module identifier when generating client manifest chore: new sponsor chore: update sponsor build: release 2.5.17-beta.0 build: build 2.5.17-beta.0 ...
This comment has been minimized.
This comment has been minimized.
pdufour
commented
Oct 22, 2018
|
I've noticed this still isn't in the latest release. https://github.com/vuejs/vue/blob/v2.5.17/package.json. When is this merge expected to be released in Vue.js? |


TheLarkInn commentedApr 28, 2018
•
edited
What kind of change does this PR introduce? (check at least one)
package.jsonfield additionDoes this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
devbranch for v2.x (or to a previous version branch), not themasterbranchfix #xxx[,#xxx], where "xxx" is the issue number)If adding a new feature, the PR's description includes:
This PR adds the
"sideEffects": falseproperty in vue'spackage.jsonfile. This allow's webpack (for those who want to opt-in to requiring vue's original source files (instead of the flattened esm bundles) and want to remove flow type through a babel-transform, 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).Happy to answer any other questions.
~Sean + webpack team
Other information: