webpack-hot-middleware
Advanced tools
Comparing version 2.14.0 to 2.15.0
@@ -10,3 +10,4 @@ /*eslint-env browser*/ | ||
log: true, | ||
warn: true | ||
warn: true, | ||
name: '' | ||
}; | ||
@@ -23,2 +24,5 @@ if (__resourceQuery) { | ||
} | ||
if (overrides.name) { | ||
options.name = overrides.name | ||
} | ||
if (overrides.quiet && overrides.quiet !== 'false') { | ||
@@ -149,2 +153,5 @@ options.log = false; | ||
case "sync": | ||
if (obj.name && options.name && obj.name !== options.name) { | ||
return; | ||
} | ||
if (obj.errors.length > 0) { | ||
@@ -151,0 +158,0 @@ if (reporter) reporter.problems('errors', obj); |
{ | ||
"name": "webpack-hot-middleware", | ||
"version": "2.14.0", | ||
"version": "2.15.0", | ||
"description": "Webpack hot reloading you can attach to your own server", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -83,2 +83,3 @@ # Webpack Hot Middleware | ||
* **path** - The path which the middleware is serving the event stream on | ||
* **name** - Bundle name, specifically for multi-compiler mode | ||
* **timeout** - The time to wait after a disconnection before attempting to reconnect | ||
@@ -99,2 +100,26 @@ * **overlay** - Set to `false` to disable the DOM-based client-side overlay. | ||
### Multi-compliler mode | ||
If you're using multi-compiler mode (exporting an array of config in `webpack.config.js`), set `name` parameters to make sure bundles don't process each other's updates. For example: | ||
``` | ||
// webpack.config.js | ||
module.exports = [ | ||
{ | ||
name: 'mobile', | ||
entry: { | ||
vendor: 'vendor.js', | ||
main: ['webpack-hot-middleware/client?name=mobile', 'mobile.js'] | ||
} | ||
}, | ||
{ | ||
name: 'desktop', | ||
entry: { | ||
vendor: 'vendor.js', | ||
main: ['webpack-hot-middleware/client?name=desktop', 'desktop.js'] | ||
} | ||
} | ||
] | ||
``` | ||
## Other Frameworks | ||
@@ -101,0 +126,0 @@ |
@@ -103,2 +103,40 @@ /* eslint-env mocha, browser */ | ||
context("with name options", function() { | ||
beforeEach(function setup() { | ||
global.__resourceQuery = '?name=test'; // eslint-disable-line no-underscore-dangle | ||
global.window = { | ||
EventSource: sinon.stub().returns({ | ||
close: sinon.spy() | ||
}) | ||
}; | ||
}); | ||
beforeEach(loadClient); | ||
it("should not trigger webpack if event obj name is different", function() { | ||
var eventSource = window.EventSource.lastCall.returnValue; | ||
eventSource.onmessage(makeMessage({ | ||
name: 'foo', | ||
action: 'built', | ||
time: 100, | ||
hash: 'deadbeeffeddad', | ||
errors: [], | ||
warnings: [], | ||
modules: [] | ||
})); | ||
sinon.assert.notCalled(processUpdate); | ||
}); | ||
it("should not trigger webpack on successful syncs if obj name is different", function() { | ||
var eventSource = window.EventSource.lastCall.returnValue; | ||
eventSource.onmessage(makeMessage({ | ||
name: 'bar', | ||
action: 'sync', | ||
time: 100, | ||
hash: 'deadbeeffeddad', | ||
errors: [], | ||
warnings: [], | ||
modules: [] | ||
})); | ||
sinon.assert.notCalled(processUpdate); | ||
}); | ||
}); | ||
context("with no browser environment", function() { | ||
@@ -105,0 +143,0 @@ beforeEach(function setup() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43251
978
163