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

前端 未结 3 805
悲哀的现实
悲哀的现实 2021-02-03 11:51

Here is my webpack config :

var path = require(\'path\');
var webpack = require(\'webpack\')
var HtmlWebpackPlugin = require(\'html-webpack-plugin\')
var fs = re         


        
3条回答
  •  被撕碎了的回忆
    2021-02-03 12:38

    I have same problem and below config work for me.

    I used to have absolute path and when change it to relative, it work.

    new HtmlWebpackPlugin({
            inject: true,
            template:'public/index.html', // relative to project root 
            filename:'index.html'         // relative to build folder
        })
    

提交回复
热议问题