1.router文件中使用webpack
export default new Router({ routes: [{ path: '/', name: 'Post', component: () => import ('@/components/Post') }, { path: '/After', name: 'After', component: () => import ('@/components/After') }, { path: '/Post', name: 'Post', component: () => import ('@/components/Post') } ] })
在webpack.base.conf.js文件中配置chunkFileName web
output: { path: config.build.assetsRoot, filename: '[name].js', chunkFilename: '[name].js', publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath },