[英]Opening index.html over file:// from Vue-cli template
When I run npm run build
command, from this Vue-cli template , it says: 当我运行npm run build
命令时,从此Vue-cli模板显示 :
Tip: built files are meant to be served over an HTTP server. 提示:内置文件应通过HTTP服务器提供。
Opening index.html over file:// won't work. 在file://上打开index.html无效。
So, the question is simple, is there any possibility, to open index.html with file:// , and it will works? 因此,问题很简单,有没有可能使用file://打开index.html ,它将起作用吗?
Change assetsPublicPath to './', then "npm run build", and then you can open file:// in your browser. 将assetsPublicPath更改为“ ./”,然后“ npm run build”,然后您可以在浏览器中打开file://。
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.