webpack-serve-overlay
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -9,2 +9,12 @@ # Changelog | ||
## [0.3.0] - 2018-08-01 | ||
Implemented usage of `__hotClientOptions__` in the same manner as `webpack-hot-client`, | ||
making this package pretty much feature-complete, as it now works in nearly the same as | ||
the old overlay. v1 will likely be released soon after, with no expected changes. | ||
### Changed | ||
- The `errorOverlay` now uses `__hotClientOptions__` in the same manner as `webpack-hot-client` to get | ||
the WebSocket url to connect to `webpack-serve`. | ||
## [0.2.2] - 2018-06-30 | ||
@@ -33,4 +43,5 @@ | ||
[Unreleased]: https://github.com/g-rath/webpack-serve-overlay/compare/v0.2.2...HEAD | ||
[Unreleased]: https://github.com/g-rath/webpack-serve-overlay/compare/v0.3.0...HEAD | ||
[0.3.0]: https://github.com/g-rath/webpack-serve-overlay/compare/v0.2.2...v0.3.0 | ||
[0.2.2]: https://github.com/g-rath/webpack-serve-overlay/compare/v0.2.1...v0.2.2 | ||
@@ -37,0 +48,0 @@ [0.2.1]: https://github.com/g-rath/webpack-serve-overlay/compare/v0.2.0...v0.2.1 |
@@ -121,4 +121,18 @@ 'use strict'; | ||
const ws = new WebSocket(process.env.WEBPACK_SERVE_OVERLAY_WS_URL || 'ws://localhost:8081'); | ||
const url = require('url'); | ||
// this is piped in at runtime build via DefinePlugin in /lib/plugins.js | ||
// taken from https://github.com/webpack-contrib/webpack-hot-client/blob/master/lib/client/index.js#L14 | ||
const options = __hotClientOptions__; | ||
const { host } = options.webSocket; | ||
const socketUrl = url.format({ | ||
protocol: options.https ? 'wss' : 'ws', | ||
hostname: host === '*' ? window.location.hostname : host, | ||
port: options.webSocket.port, | ||
slashes: true, | ||
}); | ||
const ws = new WebSocket(process.env.WEBPACK_SERVE_OVERLAY_WS_URL || socketUrl); | ||
ws.addEventListener('message', message => { | ||
@@ -125,0 +139,0 @@ const data = JSON.parse(message.data); |
{ | ||
"name": "webpack-serve-overlay", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Error overlay for webpack-serve", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
# webpack-serve-overlay | ||
A rudimentary overlay for webpack-serve, based off the one used in `webpack-dev-server`. | ||
A rudimentary overlay for [`webpack-serve`](https://github.com/webpack-contrib/webpack-serve), based off the one used in `webpack-dev-server`. | ||
This overlay is currently in development. It's fully working, | ||
but has none of the clever automagical features like inserting itself into `webpack.entry`. | ||
These features (and more) should hopefully come with time. Right now this package serves as a quick fully functional way of | ||
This package is targeted at serves as a quick fully functional way of | ||
being able to have the same overlay as `webpack-dev-server` in `webpack-serve` with minimal fuss & expense. | ||
@@ -33,6 +30,5 @@ | ||
The overlay works by using a WebSocket that connects to `ws://localhost:8081` by default. | ||
The overlay works by using a WebSocket that connects to `webpack-serve` à la `webpack-hot-client`. | ||
This means that it *shouldn't* require any extra settings or configuration. | ||
This value can be overridden by setting the `WEBPACK_SERVE_OVERLAY_WS_URL` env property. | ||
I aim to later add functionality to get this (and similar) values from `webpack-serve` itself. | ||
However, just in case, you can manually specify the WebSocket url by setting the `WEBPACK_SERVE_OVERLAY_WS_URL` env property. |
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
19557
390
34