可以1.使用webpack的import函数 import ( /* webpackChunkName: "moment" */ 'moment').then(({ default: moment}) => { }).catch(error => 'An error occurred while loading the component'); 将会把moment单独打包 异步引用2.手动配置webpack的 splitChunks插件中的cacheGroups参数 splitChunks: { cacheGroups: { moment: { test: /[\\/]node_modules[\\/](moment)[\\/]/, name: 'moment', priority: 3, chunks: 'initial', } } }
可以
1.使用webpack的import函数
将会把moment单独打包 异步引用
2.手动配置webpack的 splitChunks插件中的cacheGroups参数