Webpack how to reload page?

the file directory structure is roughly as follows:

clipboard.png

In

index.html, dist/index.js is directly introduced into
< script src= ". / dist/index.js" > < / script >

.

executes the command "webpack--watch & webpack-dev-server" and finds that dist/index.js is updated when you change the files in the src directory, but index.html does not have reload.

ask: when changing the original src file, how can I reload index.html? at the same time?

// webpack.config.js devServer
devServer: {
  contentBase: __dirname,
  host: ip,
  port: 8081,
  historyApiFallback: true
}
Mar.02,2021

execute the command webpack-dev-server directly. You can use HMR to implement reload, but at this time the generated js is in memory and there are no files in the dist folder.
and I just need the js under dist (actually weex.js) to generate a QR code to display it, so I still haven't achieved my goal. Look forward to the great god.

// webpack.config.js
plugins: [new webpack.NamedModulesPlugin(), new webpack.HotModuleReplacementPlugin()],
devServer: {
  contentBase: __dirname,
  host: ip,
  port: 8081,
  historyApiFallback: true,
  hot: true,
  inline: true
}
Menu