关于baseUrl
baseUrl是生产环境打包资源的前缀地址,写上这个,就可以直接在最终的html文件中,生成线上的访问地址:
1 2 3 4
| module.exports = { baseUrl: 'http://s.thsi.cn/js/bigscreen/res/20200513/', outputDir: process.env.outputDir, }
|
这个地址后面接的路径,是相对哪个目录的呢?是相对outputDir的。
注意,Deprecated since Vue CLI 3.3, please use publicPath instead。
和pages的设置有关吗?
有关系,当你通过pages配置了多页面时,最终写入到html中的js文件名,就是你配置的page的键名,请看官方文档:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| pages: { index: { entry: 'src/main.js', template: 'public/index.html', filename: 'index.html', title: 'Index Page' }, screen8: { entry: 'src/pages/screen8/main.js', template: 'public/screen8.html', filename: 'screen8.html', title: 'screen8' } }
|
pages下指定的template不存在会怎么处理?
见注释:
1 2 3 4 5 6 7 8 9 10
|
screen8: { entry: 'src/pages/screen8/main.js', template: 'public/screen8.html', filename: 'screen8.html', title: 'screen8' }
|
chunk-vendors和chunk-common是什么?
看官方文档:https://github.com/webpack/webpack/tree/master/examples/common-chunk-and-vendor-chunk