Skip to content

如何修改 routeComponents ? 原本使用的是 React.lazy 方式,如何优雅替换? #11812

Answered by fz6m
Lemonreds asked this question in Q&A
Discussion options

You must be logged in to vote

在 umi 4 中所有路由都是默认拆包,这样可以减少加载 js 体积,如果不希望懒加载,要换掉只能全部换掉:

  routeLoader: { moduleType: 'cjs' }

但这样会生成非常大的单文件产物,因为所有路由都没有分包汇总在一起了。

目前做不到手动配置哪些路由拆包哪些不拆包,只能全拆或全不拆。

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@penny006
Comment options

@fz6m
Comment options

Answer selected by Lemonreds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants