[HMR] Cannot find update (Full reload needed)
See original GitHub issueI apologise if this has been submitted before, but I am running into problems with HMR. I am trying to implement HMR in my framework and thought it was working until recently. Now whenever the modules are updated, the HMR reloads the page indefinitely. The error output is below:
[HMR] Cannot find update (Full reload needed)
[HMR] (Probably because of restarting the server)
[HMR] Reloading page
I am using a slightly out of the ordinary setup: browsersync as my server, webpack for js compilation and my config is below:
Browsersync/HMR setup
/**
* gulp serve
* Gulp task to run Browsersync server
*/
const path = require('path');
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
const config = require('../config');
const webpackConfig = require('./webpack.config.js');
const compiler = webpack(webpackConfig);
gulp.task('serve', ['watcher'], () => {
webpackConfig.plugins.push(
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
);
for (const key in config.js.entryPoints) {
config.js.entryPoints[key].push('webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true');
}
browserSync.init({
server: {
baseDir: './',
},
middleware: [
webpackDevMiddleware(compiler, {
stats: 'errors-only',
publicPath: path.resolve(webpackConfig.output.publicPath),
}),
webpackHotMiddleware(compiler),
],
files: [
`${config.css.distDir}/**/*.css`,
// `${config.js.distDir}/**/*.js`,
`${config.img.distDir}/**/*`,
`${config.svg.distDir}/**/*`,
'**/*.html',
],
});
});
Webpack config
/**
* Webpack config
*/
const path = require('path');
const webpack = require('webpack');
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
const config = require('../config');
const webpackConfig = {
entry: config.js.entryPoints,
output: {
path: path.resolve(`${config.js.distDir}`),
publicPath: '/',
filename: '[name].js',
},
devServer: {
inline: true,
port: 3000,
stats: 'errors-only',
},
module: {
rules: [
{
test: /\.js$/,
//exclude: /node_modules/,
loader: 'babel',
query: {
// presets: [
// 'es2015',
// ],
cacheDirectory: true,
},
},
],
},
devtool: 'source-map', // Source maps
plugins: [
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebookincubator/create-react-app/issues/240
new CaseSensitivePathsPlugin(),
],
};
if (process.env.RELEASE) {
webpackConfig.plugins.push(
new webpack.optimize.DedupePlugin(),
// Minify the code using Uglify
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
output: {
comments: false,
},
}),
new webpack.BannerPlugin(config.misc.banner, {
raw: true,
})
);
}
module.exports = webpackConfig;
Am I doing anything obviously wrong?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:14
Top Results From Across the Web
hot module replacement HMR Cannot find update. Need to do ...
I'm using electron and I have an ejected create react app webpack config. I have Hot Module Replacement enabled. The hot updates are...
Read more >Sage 9 - [HMR] Cannot find update (Full reload needed)
Hello, I have a issue when I run yarn start, the page reloads indefinitely 9 times out of 10. I have already read...
Read more >gaearon/react-hot-loader - Gitter
React hot reloaded doesn't seem to work all the time for me ... only-dev-server.js:27 [HMR] Cannot find update. Need to do a full...
Read more >Hot Module Replacement - webpack
This feature is great for productivity. All we need to do is update our webpack-dev-server configuration, and use webpack's built-in HMR plugin. We'll...
Read more >webpack-hot-middleware - Bountysource
Webpack hot reloading you can attach to your own server ... [HMR] Cannot find update (Full reload needed) [HMR] (Probably because of restarting...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just ran into this issue too. In my case it was because my
publicPathoption for webpack-dev-middleware ended with a trailing slash. Removing that fixed the problem for me.I’m facing a very similar issue. As soon as I start the server, I get:
I’m using
write-file-pluginfor webpack, and the funny thing is, that this missinghot-update.jsonfile won’t be generated until after I’ve made my first edit in any component. Somehow the request seems to go out before, leading to the 404.Notably, all successive HMR updates work fine just fine.
Hot middleware
Dev middleware