webpack配置:build


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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM