Vue项目用webpack打包后显示文件名(魔法注释)
- webpack.prod.conf.js文件修改 output
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[name].[chunkhash].js')
},
- 在路由或组件中找到懒加载组件的component
{
path: 'home',
name: 'home',
component: ()=> import(/* webpackChunkName: 'home' */'../components/home.vue')
},
其中/* webpackChunkName: 'home' */中的home即是打包后显示的文件名称(包含哈希值)
PS:欢迎加入vue技术交流群(864583465)进行更多问题的探讨,你的问题将是我们大家共同进步的关键
Vue项目用webpack打包后显示文件名魔法注释&spm=1001.2101.3001.5002&articleId=107564380&d=1&t=3&u=acfc4c6e8d9a4c59bfbf12078a0b7c2a)
1439

被折叠的 条评论
为什么被折叠?



