Skip to content

Commit

Permalink
Change approach
Browse files Browse the repository at this point in the history
  • Loading branch information
blainekasten committed Feb 16, 2020
1 parent de4b50a commit e59a8ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
7 changes: 1 addition & 6 deletions src/runtime/WHMEventSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@
*/

module.exports = function loadWHMEventSource(messageHandler) {
let client;
try {
client = require('webpack-hot-middleware/client');
} catch (e) {
return false;
}
const client = require('webpack-hot-middleware/client');

client.useCustomOverlay({
showProblems(type, data) {
Expand Down
10 changes: 6 additions & 4 deletions src/runtime/createSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ const loadWHMEventSource = require('./WHMEventSource');
let SocketClient;
if (typeof __webpack_dev_server_client__ !== 'undefined') {
SocketClient = __webpack_dev_server_client__;
} else {
SocketClient = require('./SockJSClient');
// } else {
// SocketClient = require('./SockJSClient');
}

/**
* Creates a socket server for HMR according to the user's Webpack configuration.
* @param {function(*): void} messageHandler A handler to consume Webpack compilation messages.
*/
function createSocket(messageHandler) {
const loadedWHMEventSource = loadWHMEventSource(messageHandler);
if (loadedWHMEventSource) return;
if (!SocketClient) {
loadWHMEventSource(messageHandler);
return;
}

const connection = new SocketClient(
// TODO: Dynamically generate this to handle resourceQuery
Expand Down

0 comments on commit e59a8ad

Please sign in to comment.