0
votes

Try to roll into the webpack. Using official docs. index.js reloads but index.html does not. Command for build: webpack-dev-server --mode development --open

explorer project in vs code

wp config:

const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'index.js',
    path: path.resolve(__dirname, './dist'),
  },
  devServer: {    
  }
};

package.json scripts:

"scripts": {
    "build": "webpack --mode production",
    "dev": "webpack-dev-server --mode development --open"
 },

Webpack ver:

"devDependencies": {
    "webpack": "^4.10.2",
    "webpack-cli": "^2.1.4",
    "webpack-dev-server": "^3.1.4"
 }

*Do not ask HtmlWebpackPlugin, I think without this hack should work.

1
what is happening when you call npm run dev - brk

1 Answers

0
votes

I using HtmlWebpackPlugin, works well.

plugins: [
    new HtmlWebpackPlugin({
        template: './index.html'
    })
]