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

Inform --optimize-minimize is not required for tree shaking #1473

Closed
esbenp opened this issue Aug 1, 2017 · 3 comments
Closed

Inform --optimize-minimize is not required for tree shaking #1473

esbenp opened this issue Aug 1, 2017 · 3 comments

Comments

@esbenp
Copy link
Contributor

esbenp commented Aug 1, 2017

There seems to be some confusion as to when tree shaking occurs (ie what configuration is necessary). Ref #1331 webpack/webpack#4713 (comment)

Correct me if I am wrong but it seems multiple separate parts of webpack is responsible for different parts of tree shaking? Anywho, following webpack/webpack#4713 (comment) I thought it might be a good idea to note in the documentation that --optimize-minimize is not required for tree shaking to occur.

I have added an initial PR #1474 . This is not meant as a final solution but more of an opener for a discussion of how to explain that --optimize-minimize is not only way to tree shaking but a production config is.

@skipjack
Copy link
Collaborator

skipjack commented Aug 1, 2017

Ok so as you touched on in webpack/webpack#4713, I believe tree shaking is basically enabled via a combination of:

  • Using webpack's built-in support for ES6 module syntax
  • Including the UglifyJsPlugin (either via --optimize-minimize or manually in a production configuration).

I'll take a look at your PR momentarily but Tree Shaking is one of the last guides left to review and synchronize with the others, see #1258 -- this comment in particular. My preference would be to add a small note for now, as you did in your PR, and then continue this discussion in #1258 or #1331 so we can try to resolve this confusion for good in the rewrite.

@skipjack
Copy link
Collaborator

skipjack commented Aug 1, 2017

Also, thanks to @TheDutchCoder, we now have a home for small examples that back each guide. We can do the same for tree shaking so we have a single place to discuss and test things.

Note that we aren't linking to those yet from the guides themselves but probably will start doing so soon, once #1258 is finished and we have time to make sure everything is in sync.

@esbenp
Copy link
Contributor Author

esbenp commented Aug 2, 2017

I think your plan is a good path for this. Thanks for taking your time to clarify the roadmap for the guides

dear-lizhihua referenced this issue in docschina/webpack.js.org Aug 5, 2017
Note that --optimize-minimize is not required for tree shaking.

Closes #1473
Ref #1331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants