How to use tree-shaking with webpack 2 and typescript and angular 2?

前端 未结 1 1640
情歌与酒
情歌与酒 2021-02-04 15:31

I have set up webpack 2 with angular and mostly it seems to work. It does not seem though that it does the tree-shaking, since I have an app that does almost nothin

相关标签:
1条回答
  • 2021-02-04 15:58

    I have found this very nice repository with examples on how to do this.

    As mentioned in there and in the comments to the question, there are apparently bugs that prevent the tree-shaking from happening. That seems to mean it's not really possible to do now with "target": "es5".

    We can use es2015, but then we'll need some additional steps (e.g. via Babel) to compile to es5 until browsers support it.

    0 讨论(0)
提交回复
热议问题