TS 中 使用 import {A} from 'component';
webpack4 在 mode = production 情况下 也不会 使用 tree-shaking,会导致 打包整个 component 的代码,
只能写成 import A from 'component/A' 的方式;
tsconfig.json 中已经写成 了
{
"compilerOptions": {
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"removeComments": false,
...
}
}