Skip to content

Commit a553832

Browse files
committed
Only import subworkers if needed
1 parent dc36d47 commit a553832

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

packages/app/src/app/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import requirePolyfills from 'common/lib/load-dynamic-polyfills';
1414
import 'normalize.css';
1515
import 'common/lib/global.css';
1616
import theme from 'common/lib/theme';
17-
import 'subworkers';
17+
import { isSafari } from 'common/lib/utils/platform';
1818

1919
// eslint-disable-next-line
2020
import * as child_process from 'node-services/lib/child_process';
@@ -106,6 +106,10 @@ function boot() {
106106
window.controller = controller;
107107
}
108108

109+
if (isSafari) {
110+
import('subworkers');
111+
}
112+
109113
const rootEl = document.getElementById('root');
110114

111115
const showNotification = (message, type) =>
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
export const isIOS =
22
typeof navigator !== 'undefined' &&
33
!!navigator.platform.match(/(iPhone|iPod|iPad)/i);
4+
export const isSafari =
5+
typeof navigator !== 'undefined' &&
6+
/^((?!chrome|android).)*safari/i.test(navigator.userAgent);
47
export const isMac =
58
typeof navigator !== 'undefined' &&
6-
(isIOS || !!navigator.platform.match(/Mac/i));
9+
(isIOS || !!navigator.platform.match(/Mac/i));

0 commit comments

Comments
 (0)