diff --git a/middleware.js b/middleware.js index 9aa9d39..96f900a 100644 --- a/middleware.js +++ b/middleware.js @@ -26,7 +26,7 @@ function webpackHotMiddleware(compiler, opts) { }); }); return function(req, res, next) { - if (req.url !== opts.path) return next(); + if (!pathMatch(req.url, opts.path)) return next(); eventStream.handler(req, res); }; } @@ -68,6 +68,13 @@ function createEventStream(heartbeat) { }; } +function pathMatch(url, path) { + if (url == path) return true; + var q = url.indexOf('?'); + if (q == -1) return false; + return url.substring(0, q) == path; +} + function buildModuleMap(modules) { var map = {}; modules.forEach(function(module) {