Skip to content

Commit

Permalink
feat: replace querystring with urlsearchparams
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmunillas authored and glenjamin committed Aug 11, 2022
1 parent e140693 commit 6703d4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions client.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ var options = {
ansiColors: {},
};
if (__resourceQuery) {
var querystring = require('querystring');
var overrides = querystring.parse(__resourceQuery.slice(1));
var overrides = Object.fromEntries(new URLSearchParams(__resourceQuery.slice(1)));
setOverrides(overrides);
}

Expand All @@ -25,8 +24,8 @@ if (typeof window === 'undefined') {
} else if (typeof window.EventSource === 'undefined') {
console.warn(
"webpack-hot-middleware's client requires EventSource to work. " +
'You should include a polyfill if you want to support this browser: ' +
'https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools'
'You should include a polyfill if you want to support this browser: ' +
'https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events#Tools'
);
} else {
if (options.autoConnect) {
Expand Down Expand Up @@ -240,19 +239,19 @@ function processMessage(obj) {
if (options.log) {
console.log(
'[HMR] bundle ' +
(obj.name ? "'" + obj.name + "' " : '') +
'rebuilding'
(obj.name ? "'" + obj.name + "' " : '') +
'rebuilding'
);
}
break;
case 'built':
if (options.log) {
console.log(
'[HMR] bundle ' +
(obj.name ? "'" + obj.name + "' " : '') +
'rebuilt in ' +
obj.time +
'ms'
(obj.name ? "'" + obj.name + "' " : '') +
'rebuilt in ' +
obj.time +
'ms'
);
}
// fall through
Expand Down
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"dependencies": {
"ansi-html-community": "0.0.8",
"html-entities": "^2.1.0",
"querystring": "^0.2.0",
"strip-ansi": "^6.0.0"
},
"devDependencies": {
Expand Down

0 comments on commit 6703d4e

Please sign in to comment.