vue打包报错
报错内容
当打包完浏览器报
index.html:1 Access to internal resource at ‘file:///D:/manifest.json’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome-untrusted, https, edge.
Failed to load resource: net::ERR_FILE_NOT_FOUND
的错误时。
如图所示:

解决方法
1、找到vue.config.js文件,加入一条
publicPath: "./"
如图:

2、找到 src/router/index.js文件
将mode: 'history’去掉

博客主要围绕Vue打包报错展开。当打包完浏览器报CORS策略阻止访问及文件未找到错误时,给出解决办法,一是在vue.config.js文件中加入相关内容,二是在src/router/index.js文件里去掉mode: 'history’。
1050





