Giter Site home page Giter Site logo

Comments (3)

sokra avatar sokra commented on May 1, 2024

The middleware only serves the app. It doesn't include hot notification stuff. So you can't use webpack-dev-server/client or webpack/hot/only-dev-server with the middleware (hence the dev-server in the module).

You can implement hot notification + HMR management code for your own server. (or just use the webpack-dev-server)

from webpack-dev-middleware.

grrowl avatar grrowl commented on May 1, 2024

Ah, I was under the impression this wrapped webpack-dev-server in some way. I decided to run a webpackDevServer alongside the middleware, seems to work well:

  grunt.registerTask('hotserver:dev', function () {
    var WebpackDevServer = require('webpack-dev-server'),
        config = webpackConfig(['client', 'dev']),
        host = '0.0.0.0',
        port = 8001; // must match port in webpack config for client/dev

    new WebpackDevServer(webpack(config), {
      publicPath: config.output.publicPath,
      hot: true
    }).listen(port, host, function (err, result) {
      if (err)
        console.log(err);

      console.log('Hot server listening at '+ host +':'+ port);
    });
  });

Although since this appears to wrap expressjs, so I may just add my server middleware into that if possible, instead to avoid running two servers while on dev. Thanks for your help!

from webpack-dev-middleware.

pixeldrew avatar pixeldrew commented on May 1, 2024

I use this module https://www.npmjs.com/package/webpack-hot-middleware

from webpack-dev-middleware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.