Ant Design Pro 如何开启代码拆分?
How do you enable code splitting in Ant Design Pro?
Ant Design Pro 包在 gzip 之前可能会变得非常大。我的简单捆绑包高达 3.9MB。我们如何使用 Ant Design Pro 启用代码拆分。我在V4 Ant Design Pro的文档中好像找不到。
好的,我明白了。如果有人有同样的问题,请在此处发布,因为它尚未记录。事实证明,默认情况下代码拆分是关闭的。在配置文件中查找 dynamicImport
属性并取消注释。
config/config.js
const plugins = [
[
'umi-plugin-react',
{
antd: true,
dva: {
hmr: true,
},
locale: {
...
baseNavigator: true,
},
dynamicImport: {
loadingComponent: './components/PageLoading/index',
webpackChunkName: true,
level: 3,
},
...
}
]
]
开启umi配置dynamicImport
。
https://umijs.org/plugin/umi-plugin-react.html#dynamicimport
Ant Design Pro 包在 gzip 之前可能会变得非常大。我的简单捆绑包高达 3.9MB。我们如何使用 Ant Design Pro 启用代码拆分。我在V4 Ant Design Pro的文档中好像找不到。
好的,我明白了。如果有人有同样的问题,请在此处发布,因为它尚未记录。事实证明,默认情况下代码拆分是关闭的。在配置文件中查找 dynamicImport
属性并取消注释。
config/config.js
const plugins = [
[
'umi-plugin-react',
{
antd: true,
dva: {
hmr: true,
},
locale: {
...
baseNavigator: true,
},
dynamicImport: {
loadingComponent: './components/PageLoading/index',
webpackChunkName: true,
level: 3,
},
...
}
]
]
开启umi配置dynamicImport
。
https://umijs.org/plugin/umi-plugin-react.html#dynamicimport