Skip to content

Commit 3ea39ad

Browse files
committed
feat(client): introduce core-js
1 parent 9c5f6bb commit 3ea39ad

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

client-src/default/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { log, setLogLevel } from './utils/log';
99
import sendMessage from './utils/sendMessage';
1010
import reloadApp from './utils/reloadApp';
1111
import createSocketUrl from './utils/createSocketUrl';
12+
import { array, string } from './polyfill';
1213

1314
const status = {
1415
isUnloading: false,
@@ -31,7 +32,7 @@ self.addEventListener('beforeunload', () => {
3132

3233
if (typeof window !== 'undefined') {
3334
const qs = window.location.search.toLowerCase();
34-
options.hotReload = qs.indexOf('hotreload=false') === -1;
35+
options.hotReload = !string.includes(qs, 'hotreload=false');
3536
}
3637

3738
const onSocketMessage = {
@@ -63,7 +64,7 @@ const onSocketMessage = {
6364
},
6465
'log-level': function logLevel(level) {
6566
const hotCtx = require.context('webpack/hot', false, /^\.\/log$/);
66-
if (hotCtx.keys().indexOf('./log') !== -1) {
67+
if (array.includes(hotCtx.keys(), './log')) {
6768
hotCtx('./log').setLogLevel(level);
6869
}
6970
setLogLevel(level);

client-src/default/polyfill.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import stringIncludes from 'core-js/features/string/includes';
2+
import arrayIncludes from 'core-js/features/array/includes';
3+
4+
export const array = {
5+
includes: arrayIncludes,
6+
};
7+
8+
export const string = {
9+
includes: stringIncludes,
10+
};

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"chokidar": "^3.0.1",
4141
"compression": "^1.7.4",
4242
"connect-history-api-fallback": "^1.6.0",
43+
"core-js": "^3.1.3",
4344
"debug": "^4.1.1",
4445
"del": "^4.1.1",
4546
"express": "^4.17.1",

0 commit comments

Comments
 (0)