From e721e8dd127a441d7077a9ee75cb4b24cb765ca0 Mon Sep 17 00:00:00 2001 From: caryli Date: Tue, 3 Oct 2017 19:55:06 -0700 Subject: [PATCH] Set options.host to 'localhost' Define the host property of the options object and set it to 'localhost'. The webpack-dev-server CLI defaults the host to 'localhost', but addDevServerEntrypoints from the webpack-dev-server Node.js API does not set a default and leaves it undefined, which will eventually throw "Uncaught SyntaxError: The URL 'http:/sockjs-node' is invalid" in the browser when following the code example. Discussion reference: https://github.com/webpack/webpack-dev-server/pull/1129 --- src/content/guides/hot-module-replacement.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/content/guides/hot-module-replacement.md b/src/content/guides/hot-module-replacement.md index d3907cdae745..8a871da0a3f6 100644 --- a/src/content/guides/hot-module-replacement.md +++ b/src/content/guides/hot-module-replacement.md @@ -145,7 +145,8 @@ const webpack = require('webpack'); const config = require('./webpack.config.js'); const options = { contentBase: './dist', - hot: true + hot: true, + host: 'localhost' }; webpackDevServer.addDevServerEntrypoints(config, options);