index.html引入的css和js没有引号

vue build项目部署到线上之后,index.html文件一直报如下错误,仔细看后发现,是由于文件引入资源的时候,很多需要有引号的地方没有了,原来是打包出了问题

在对vue-cli项目打包后出现index.html引入的css和js没有引号 即:

<link href=/css/xxx.css rel=stylesheet>

解决办法:

找到webpack.prod.conf.js,在webpack.prod.conf.js找到minify

把minify中的  removeAttributeQuotes: true改为

 removeAttributeQuotes: false(如果该方法没有用那就把整个minify去掉再试一下)

然后在执行打包命令:npm run build

执行完打包后index.html中的css和js引入时就会有引号

<link href="/css/xxx.css" rel="stylesheet">

--------------------- 本文来自 coffee_i 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/i_coffer/article/details/81005733?utm_source=copy

猜你喜欢

转载自blog.csdn.net/weixin_40918145/article/details/82858150