webpack-contrib / webpack-hot-middleware

Webpack hot reloading you can attach to your own server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when refresh browser, All the previous *.hot-update.json files have been loaded again

changfuguo opened this issue · comments

for examle, when update hot-middleware

  "webpack": "^3.10.0",
    "webpack-dev-middleware": "^1.12.2",
    "webpack-hot-middleware": "^2.21.0",

the problem lead to all the changes were executed again when page refresh ,can you help me to find out what is wrong?

my code is here

  app.use(WebpackDevMiddleware(compiler, {
                stats: { colors: true },
                noInfo: true,
                publicPath: '/'
            }))
            app.use(WebpackHotMiddleware(compiler, {
                path: '/__webpack_hmr',
                timeout: 20000,
                reload: true,
                log: console.log,
                heartbeat: 10 * 1000
            }))

image

Have the same problem. Browser refresh loads all hot updates and replays them.

Has anyone been able to figure out a solution for this? It appears the upToDate function is returning false and hence the old updates are replayed. My server side code renders the latest code changes so is there a option we're missing here to ensure the middleware picks up from where it left off?

Note; my server code is running on a different express instance than my client dev server - i suspect that this is the problem.

Looked into this further and it would appear if you inline you're manifest this won't update when code is hot updated. Therefore the hotCurrentHash isn't set to the last hot update hash and thus the replaying of updates starts in order to set this to the correct value.

Short answer/solution is to reference the manifest file as a regular script src instead of inlining it (for development at least).

This year is 2019 and I still have the same problem.

My webpack dependencies are:

"webpack": "^4.30.0",
"webpack-cli": "^3.3.1",
"webpack-dev-middleware": "^3.6.2",
"webpack-hot-middleware": "^2.24.3"

Hi

Has anyone found a solution here please ?

I encountered the same issue

Bests

@navgarcha's answer #272 (comment) led me to try using the webpack-dev-middleware writeToDisk option and it worked:

app.use(
  webpackDevMiddleware(compiler, {
    // ... your options
    writeToDisk: true
  })
);

Versions used:

"webpack": "^4.29.6",
"webpack-dev-middleware": "^3.7.0",
"webpack-hot-middleware": "^2.25.0",