问题描述
在Vue项目中,index.html 我使用了script标签引入了一个在static目录下的文件
这是项目目录,我的js在static/js/xxxx.js
<script src="./static/js/xxx.js" ></script>
在dev情况下是可以使用的,但是在打包到dist后,dist目中的index.html,
还是
<script src="./static/js/xxx.js" ></script>
这样的话,我已经该怎么修复呢
在Vue项目中,index.html 我使用了script标签引入了一个在static目录下的文件
这是项目目录,我的js在static/js/xxxx.js
<script src="./static/js/xxx.js" ></script>
在dev情况下是可以使用的,但是在打包到dist后,dist目中的index.html,
还是
<script src="./static/js/xxx.js" ></script>
这样的话,我已经该怎么修复呢
10 回答11.2k 阅读
5 回答4.9k 阅读✓ 已解决
4 回答3.2k 阅读✓ 已解决
2 回答2.8k 阅读✓ 已解决
2 回答4.8k 阅读✓ 已解决
4 回答4.4k 阅读✓ 已解决
4 回答1.9k 阅读✓ 已解决
在webpack.base.conf.js中
使用时 'static/js/lalal.js' 前面不用 ./
utils.js中
index.js中
assetsPublicPath: './', //前面加个点
这样打包后路径就不会有错了