Webpack hot update is invalid

1. Project structure:

clipboard.png

2.webpack.config.jspackage.json:

clipboard.png

3.index.html:

clipboard.png

question:
1. The console information shows that the hot update should be successful, but the page has not been refreshed, and the dist file has not changed. How to modify the configuration?
what is the relationship between 2.webpack-dev-server and HotModuleReplacePlugin,webpack-dev-middlevare webpack-hot-middle?


if your webpack4 or react project can consider using this for hot updates react-hot-loader , just report one layer in the router location, for example, export default hot (module) (AppRouter) ,

your method requires an additional line of code in entry. According to my own erection, I need ['webpack-dev-server/client', _ dirname + "/ src/main.js],

.

or execute this method in the entry file

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

my configuration:
package.json

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "webpack --watch",
    "start": "webpack-dev-server --open",
    "build": "webpack --env.production"
  }

webapck.config.js

  devServer: {
        host: '0.0.0.0',
        useLocalIp: true,
        contentBase: path.resolve(__dirname, 'dist'),
        openPage: "webpack-dev-server",
        compress: true,
        port: 9000,
        open: true,
    }

did you find the problem? I encountered this, too.


my dev-server configuration

const hotMiddleware = require('webpack-hot-middleware')(compiler, {
  log: false,
  heartbeat: 2000
})
app.use(hotMiddleware)

dev-client configuration

'use strict'
require('eventsource-polyfill')
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')

hotClient.subscribe(function (event) {
  if (event.action === 'reload') {
    window.location.reload()
  }
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea784c-47c1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea784c-47c1a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?