webpack vue html,vue.js - Vue + html-webpack-plugin not load index.html generated - Stack Overflow

After reading the answers here and about two days of research, on the same problem, it turns out that this issue is related specifically to the fact that the webpack-development-server does not write files to your local file system and instead writes its files to MEMORY ONLY.

You SHOULD be able to properly generate files wth Html-Webpack-Plugin when you run the default webpack build command (NOT the WDS / Webpack-Development-Server) with:

webpack

Keep in mind you must be in the project directory. Alternately for those using vue.js Webpack-simple project (https://github.com/vuejs-templates/webpack-simple/tree/master/template) you can use the npm scripts that come with the Vue.js sample (located inside of your package.json) via:

npm run build

If all goes well you will notice that the files ARE written to the directory as you would have thought they should be, but were not, when using Webpack-Development-Server (again this does not work because WDS writes to memory and not the local file system).

You can see this StackOverflow question also runs into the issue when using the base Vue.js Webpack project:

html-webpack-plugin not inject js file into index.html when using webpack-dev-server

I stumbled onto this answer when reading the above question since the user mentions:

"If I run webpack or npm run build, the js file is injected successfully. Can html-webpack-plugin also inject js file into index.html when I'm in localhost?"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值