build
配置:assetsSubDirectory
和 assetsPublicPath
index: resolve('dist/index.html'), // Paths assetsRoot: resolve('dist'), assetsSubDirectory: 'static', // assetsPublicPath: '/', assetsPublicPath: 'http://130.130.152.65:8001/',
index
: 模板
assetRoot
: 打包后文件要存放的路径
assetsSubDirectory
: 把所有的静态资源打包到 dist
下的 static文件夹下
assetsPublicPath
: 代表生成的index.html
文件,里面引入资源时,路径前面要加上 ./static/
,也就是assetsPublicPath的值
由此可见 ,我们可以直接 设置 assetsPublicPath
为绝对路径,比如自己的线上路径前缀, https://www.yourdomain.com/
,则打包后的路径,全部会加上这个 前缀
参考:
https://blog.csdn.net/weixin_33920401/article/details/87962115
https://blog.csdn.net/hongchh/article/details/55113751