【发布时间】:2019-02-14 17:26:08
【问题描述】:
在 webpack 4 中没有 Babel 的情况下,外部模块(如 React 或 Antd)是否可以摇动(摇树)?
示例反应结构: node_modules->react 文件夹包括 /cjs 和 /umd 目录。
设置:
项目:
https://github.com/webpack/webpack/tree/master/examples/harmony-unused
配置
https://webpack.js.org/guides/tree-shaking/
Typescript-Loader(可选)https://github.com/TypeStrong/ts-loader
src 文件会被摇动,都包括像antd这样的node_modules或者react not。
向里奇问好
【问题讨论】:
标签: reactjs webpack antd tree-shaking