![](/img/trans.png)
[英]How does main.js link to Index.html in Vue-cli webpack template
[英]Opening index.html over file:// from Vue-cli template
當我運行npm run build
命令時,從此Vue-cli模板顯示 :
提示:內置文件應通過HTTP服務器提供。
在file://上打開index.html無效。
因此,問題很簡單,有沒有可能使用file://打開index.html ,它將起作用嗎?
將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.