首页 > 其他 > 详细

vue-cli中 assetsPublicPath, assetsSubDirectory的区别

时间:2019-12-03 20:02:21      阅读:1154      评论:0      收藏:0      [点我收藏+]

webpack配置代码:

index: path.resolve(__dirname, ‘../dist/index.html‘),
assetsRoot: path.resolve(__dirname, ‘../dist‘),
assetsSubDirectory: ‘static‘,
assetsPublicPath: ‘./projectName‘

上述代码的含义:

assetsRoot : 在当前目录的上一级 的 dist目录下输出资源文件

assetsSubDirectory: 把所有的静态资源打包到 dist下的 static文件夹下

assetsPublicPath :代表生成的index.html文件,里面引入资源时,路径前面要加上 ./projectName/,也就是assetsPublicPath的值,即在index.html代码中引用静态文件:

<script type="text/javascript" src="./projectName/static/js/app.js"></script>

vue-cli中 assetsPublicPath, assetsSubDirectory的区别

原文:https://www.cnblogs.com/fewhj/p/11978773.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!