vue项目运行报错Refused to load the image 'http://localhost:8080/favicon.ico' because it violates the follo

Refused to load the image ‘http://localhost:8080/favicon.ico’ because it violates the following Content Security Policy directive: “default-src ‘none’”. Note that ‘img-src’ was not explicitly set, so ‘default-src’ is used as a fallback.

因为打包配置config下的index.js里面assetsPublicPath 的路径为assetsPublicPath:’./’,改成assetsPublicPath:’/’,重新启动项目,即可运行成功。原因不知道,个人猜测可能是打包后路径层级发生了变化
在这里插入图片描述

发布了43 篇原创文章 · 获赞 4 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/darkCloudss/article/details/103710310