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