Skip to content

Commit

Permalink
Fix HMR on .localhost domains (#9435)
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Dec 13, 2023
1 parent 0980b25 commit bd40574
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/reporters/dev-server/src/templates/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h2 class="error-message"><%- error.message %></h2>
// 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';
Expand Down
2 changes: 1 addition & 1 deletion packages/runtimes/hmr/src/loaders/hmr-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down

0 comments on commit bd40574

Please sign in to comment.