[Configuration] webpack hot update

first step

  devServer: {
    contentBase: path.join(__dirname, 'dist'),
    compress: true,
    port: 9000,
    hot: true
  },

 

Part II

  plugins: [
    new HtmlWebpackPlugin(),
    new webpack.HotModuleReplacementPlugin()
  ]

 

The third part (file entry, entry)

if (module.hot) {
  module.hot.accept()
}

 

The official introduction

Guess you like

Origin www.cnblogs.com/wuxianqiang/p/11183280.html