webpack-hot-middleware
Advanced tools
Comparing version 2.18.2 to 2.19.0
@@ -11,3 +11,4 @@ /*eslint-env browser*/ | ||
warn: true, | ||
name: '' | ||
name: '', | ||
autoConnect: true | ||
}; | ||
@@ -17,2 +18,27 @@ if (__resourceQuery) { | ||
var overrides = querystring.parse(__resourceQuery.slice(1)); | ||
setOverrides(overrides); | ||
} | ||
if (typeof window === 'undefined') { | ||
// do nothing | ||
} else if (typeof window.EventSource === 'undefined') { | ||
console.warn( | ||
"webpack-hot-middleware's client requires EventSource to work. " + | ||
"You should include a polyfill if you want to support this browser: " + | ||
"https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools" | ||
); | ||
} else { | ||
if (options.autoConnect) { | ||
connect(); | ||
} | ||
} | ||
/* istanbul ignore next */ | ||
function setOptionsAndConnect(overrides) { | ||
setOverrides(overrides); | ||
connect(); | ||
} | ||
function setOverrides(overrides) { | ||
if (overrides.autoConnect) options.autoConnect = overrides.autoConnect == 'true'; | ||
if (overrides.path) options.path = overrides.path; | ||
@@ -32,2 +58,3 @@ if (overrides.timeout) options.timeout = overrides.timeout; | ||
} | ||
if (overrides.dynamicPublicPath) { | ||
@@ -38,14 +65,2 @@ options.path = __webpack_public_path__ + options.path; | ||
if (typeof window === 'undefined') { | ||
// do nothing | ||
} else if (typeof window.EventSource === 'undefined') { | ||
console.warn( | ||
"webpack-hot-middleware's client requires EventSource to work. " + | ||
"You should include a polyfill if you want to support this browser: " + | ||
"https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools" | ||
); | ||
} else { | ||
connect(); | ||
} | ||
function EventSourceWrapper() { | ||
@@ -256,4 +271,5 @@ var source; | ||
if (reporter) reporter.useCustomOverlay(customOverlay); | ||
} | ||
}, | ||
setOptionsAndConnect | ||
}; | ||
} |
{ | ||
"name": "webpack-hot-middleware", | ||
"version": "2.18.2", | ||
"version": "2.19.0", | ||
"description": "Webpack hot reloading you can attach to your own server", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -13,3 +13,3 @@ /** | ||
var hmrDocsUrl = "http://webpack.github.io/docs/hot-module-replacement-with-webpack.html"; // eslint-disable-line max-len | ||
var hmrDocsUrl = "https://webpack.js.org/concepts/hot-module-replacement/"; // eslint-disable-line max-len | ||
@@ -16,0 +16,0 @@ var lastHash; |
@@ -29,3 +29,4 @@ # Webpack Hot Middleware | ||
new webpack.HotModuleReplacementPlugin(), | ||
new webpack.NoErrorsPlugin() | ||
// Use NoErrorsPlugin for webpack 1.x | ||
new webpack.NoEmitOnErrorsPlugin() | ||
] | ||
@@ -93,2 +94,3 @@ ``` | ||
* **dynamicPublicPath** - Set to `true` to use webpack `publicPath` as prefix of `path`. (We can set `__webpack_public_path__` dynamically at runtime in the entry point, see note of [output.publicPath](https://webpack.js.org/configuration/output/#output-publicpath)) | ||
* **autoConnect** - Set to `false` to use to prevent a connection being automatically opened from the client to the webpack back-end - ideal if you need to modify the options using the `setOptionsAndConnect` function | ||
@@ -95,0 +97,0 @@ #### Middleware |
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
109786
924
183