-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[plugin-dva] 权限路由依然触发history.listen,model如何按需加载 #172
Comments
是的,找了半天怎么按需加载, 发现好像不能啊。。 |
umi@3 的 model 没有按需加载 |
但是我需要这个功能, 所以umi@3有计划添加这个功能吗 |
@sorrycc cc |
其实主要是model文件虽小,但是数量非常多,首屏加载很耗时,我尝试过codesplit想把这些model合起来,但是发现这样做后虽然index.html里会在加载umi.js后加载models.js, 但页面白屏也不报错 chunks: [ 'umi','models'],
chainWebpack: function (config, { env }) {
config.merge({
optimization: {
minimize: env === 'production',
splitChunks: {
chunks: 'all',
minSize: 1,
minChunks: 1,
automaticNameDelimiter: '.',
cacheGroups: {
vendor: {
name: 'models',
test({ resource }: any) {
const reg1 = /.*[\\/]model.ts/.test(resource)
const reg2 = /.*[\\/]models\/.*\.ts/.test(resource)
const merge = reg1 || reg2
return merge;
},
priority: 10,
},
},
},
},
});
}, |
same issue :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
umi2中页面model是按需加载,权限路由被拦截后,history.listen不会触发。
umi3中页面model是全量加载,权限路由被拦截后,history.listen依然触发。
The text was updated successfully, but these errors were encountered: