vite打包后直接浏览器打开报错
浏览器直接打开index.html报错:Access to script at 'file:///F:/code/vue3-app/dist/assets/index.9d2bd720.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protoc
·
浏览器直接打开index.html报错:
Access to script at 'file:///F:/code/vue3-app/dist/assets/index.9d2bd720.js' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.
解决办法:
vscode中安装插件:live server
然后vscode打开打包后的index.html,再点击vscode右下角的Go Live按钮,默认会运行到127.0.0.1:5500
更多推荐
已为社区贡献28条内容
所有评论(0)