diff --git a/packages/reporters/dev-server/src/templates/500.html b/packages/reporters/dev-server/src/templates/500.html
index 07d52ac66d5..ea7df0c3130 100644
--- a/packages/reporters/dev-server/src/templates/500.html
+++ b/packages/reporters/dev-server/src/templates/500.html
@@ -90,7 +90,7 @@
<%- error.message %>
// Reload the page when an HMR update occurs.
var protocol =
(location.protocol == 'https:' &&
- !/localhost|127.0.0.1|0.0.0.0/.test(hostname))
+ !['localhost', '127.0.0.1', '0.0.0.0'].includes(hostname))
? 'wss'
: 'ws';
var hostname = <%- JSON.stringify(hmrOptions.host || null) %> || location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost';
diff --git a/packages/runtimes/hmr/src/loaders/hmr-runtime.js b/packages/runtimes/hmr/src/loaders/hmr-runtime.js
index 9b060ea5b8a..2f691892489 100644
--- a/packages/runtimes/hmr/src/loaders/hmr-runtime.js
+++ b/packages/runtimes/hmr/src/loaders/hmr-runtime.js
@@ -93,7 +93,7 @@ if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
var protocol =
HMR_SECURE ||
(location.protocol == 'https:' &&
- !/localhost|127.0.0.1|0.0.0.0/.test(hostname))
+ !['localhost', '127.0.0.1', '0.0.0.0'].includes(hostname))
? 'wss'
: 'ws';