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

相关文章:

  • 2022-12-23
猜你喜欢
  • 2022-01-13
  • 2021-12-09
  • 2021-12-24
  • 2021-04-17
  • 2022-03-03
相关资源
相似解决方案