Skip to content

Commit 1e3e656

Browse files
fix: client compatibility with IE11/IE10/IE9 (#3129)
1 parent 3d91e69 commit 1e3e656

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+6848
-7455
lines changed

.eslintrc.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
module.exports = {
44
extends: ['webpack', 'prettier'],
5-
globals: {
6-
document: true,
7-
window: true,
8-
},
95
parserOptions: {
106
sourceType: 'script',
11-
ecmaVersion: 10,
7+
ecmaVersion: 2018,
8+
},
9+
env: {
10+
node: true,
11+
es6: true,
1212
},
1313
rules: {
1414
curly: 'error',
@@ -21,12 +21,30 @@ module.exports = {
2121
'global-require': 'off',
2222
},
2323
overrides: [
24+
{
25+
files: ['client-src/**/*.js'],
26+
env: {
27+
browser: true,
28+
},
29+
},
2430
{
2531
files: ['test/**/*.js'],
2632
rules: {
2733
'no-console': 'off',
2834
},
2935
},
36+
{
37+
files: [
38+
'test/client/**/*.js',
39+
'test/e2e/**/*.js',
40+
'test/fixtures/**/*.js',
41+
'test/server/liveReload-option.test.js',
42+
],
43+
env: {
44+
browser: true,
45+
node: true,
46+
},
47+
},
3048
{
3149
files: ['examples/**/*.js'],
3250
env: {

babel.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ module.exports = (api) => {
44
api.cache(true);
55

66
return {
7-
presets: ['@babel/preset-env'],
7+
presets: [
8+
[
9+
'@babel/preset-env',
10+
{
11+
targets: {
12+
node: '0.12',
13+
},
14+
},
15+
],
16+
],
817
env: {
918
test: {
1019
plugins: ['@babel/plugin-transform-runtime'],

client-src/clients/SockJSClient.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
'use strict';
22

3-
const SockJS = require('sockjs-client/dist/sockjs');
4-
const { log } = require('../default/utils/log');
3+
const SockJS = require('../modules/sockjs-client');
4+
const { log } = require('../utils/log');
55
const BaseClient = require('./BaseClient');
66

77
module.exports = class SockJSClient extends BaseClient {
88
constructor(url) {
99
super();
10+
1011
const sockUrl = url.replace(/^(?:chrome-extension|file)/i, 'http');
11-
this.sock = new SockJS(sockUrl);
1212

13+
this.sock = new SockJS(sockUrl);
1314
this.sock.onerror = (err) => {
1415
log.error(err);
1516
};

client-src/clients/WebsocketClient.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
'use strict';
22

3-
/* global WebSocket */
4-
5-
const { log } = require('../default/utils/log');
3+
const { log } = require('../utils/log');
64
const BaseClient = require('./BaseClient');
75

86
module.exports = class WebsocketClient extends BaseClient {
97
constructor(url) {
108
super();
9+
1110
const wsUrl = url.replace(/^(?:http|chrome-extension|file)/i, 'ws');
12-
this.client = new WebSocket(wsUrl);
1311

12+
this.client = new WebSocket(wsUrl);
1413
this.client.onerror = (err) => {
1514
log.error(err);
1615
};

client-src/default/webpack.config.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

client-src/default/index.js renamed to client-src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
'use strict';
22

3-
/* global __resourceQuery WorkerGlobalScope self */
4-
const stripAnsi = require('../transpiled-modules/strip-ansi');
3+
/* global __resourceQuery WorkerGlobalScope */
4+
5+
const stripAnsi = require('./modules/strip-ansi');
56
const socket = require('./socket');
67
const overlay = require('./overlay');
78
const { log, setLogLevel } = require('./utils/log');

client-src/modules/logger/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
'use strict';
2+
3+
// eslint-disable-next-line import/no-extraneous-dependencies
4+
require('core-js/stable/symbol');
5+
6+
module.exports = require('webpack/lib/logging/runtime');

0 commit comments

Comments
 (0)