-
原项目中配置的 chunks 没有生效 |
Beta Was this translation helpful? Give feedback.
Answered by
Enivia
Jul 14, 2022
Replies: 3 comments 15 replies
-
umi4 默认按页拆包,这近似等同于 umi3 中的 对于特殊场景,可手动进一步拆包: import { lazy, Suspense } from 'react'
// './Page' 该组件将被自动拆出去
const Page = lazy(() => import('./Page'))
export default function() {
return (
<Suspense fallback={<div>loading...</div}>
<Page />
</Suspense>
)
} |
Beta Was this translation helpful? Give feedback.
1 reply
-
找到了,可以这样自定义 cacheGroups。 chainWebpack(config) {
config.optimization.splitChunks.merge({
cacheGroups: {
// ...
},
});
}, 文档需要补充额。 |
Beta Was this translation helpful? Give feedback.
11 replies
Answer selected by
Enivia
-
...看了很久, 不知道什么时候能支持自定义分包设置, 目前的分包umi4 只能用给定的三种, 而打包后umi.js巨大(对于弱网环境来说), 想把一些不是首屏看到有关的js提取出来放到head里面, 尽可能减少首屏的加载方式, 不知道还有没有别的办法 |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
找到了,可以这样自定义 cacheGroups。
文档需要补充额。