Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
Can't get Webpack HMR working properly

I'm implementing a Hot Module Replacement with Webpack in my project, which uses Node(v4.4.4)/Hapi(v8.0.0) as a server. The way I thought I could get it working was by using a plugin in my server file, which is shown below:

`var compiler = new require('webpack')(webpackConfig.default);
 var assets = { noInfo: false, publicPath: webpackConfig.default.output.publicPath };
 var hot = { reload: true, noInfo: true };`

server.register({
    register: require('hapi-webpack-plugin'),
    options: {
      compiler, assets, hot
    }
  },function(error) {
    if (error) {
      return console.error(error);
    }

    server.start(function() {
      if (process.env.CONFIG_WINSTON === 'on') {
        logger.info('Hapi', server.version, server.info.uri);
      } else {
        console.log('Hapi', server.version, server.info.uri);
      }
    });
  });`

In my webpack.config.js, I'm using my entry like this:

entry: [ 'webpack-hot-middleware/client?http://localhost:8080&reload=true', './webpack_common/src/scripts/main.js', ],

I have also added this plugin in my webpack.config.js:

new webpack.HotModuleReplacementPlugin(),

And finally I have already installed the packages:

"webpack": "^2.2.1", "webpack-dev-middleware": "^1.10.1", "webpack-dev-server": "^2.4.4", "webpack-hot-middleware": "^2.17.1", "hapi-webpack-plugin": "^2.0.0",

With all this setup, I could get my HMR working fine with Sass, which means, it is rebuilding and updating my browser. However, when I change any javascript, I see log messages saying everything went well (the bundle was rebuilt),

`

[HMR] bundle rebuilding client.js?4b20:207 
[HMR] bundle rebuilt in 11952ms process-update.js:27 
[HMR] Checking for updates on the server... process-update.js:100 
[HMR] Updated modules:
A list of updated modules comes here...

[HMR] App is up to date.`

but I don't see any updates in my browser. If I manually refresh my browser, than the updates display fine. I tested with Chrome, Firefox and Safari, but none of them seems to work. I have searched through many other questions in foruns, but with no luck. Anyone has any clue on what I may need to do?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!