diff --git a/lib/types/globals.d.ts b/lib/types/globals.d.ts index 924d0ef6..a88aa89f 100644 --- a/lib/types/globals.d.ts +++ b/lib/types/globals.d.ts @@ -58,6 +58,7 @@ declare const DocumentTouch: any; declare const Rollbar: IRollbar; interface Window { + _babelPolyfill: boolean; ABT: ABT.Backend; DocumentTouch?: any; Rollbar: IRollbar; diff --git a/src/js/utils/polyfill.ts b/src/js/utils/polyfill.ts new file mode 100644 index 00000000..e14a4a93 --- /dev/null +++ b/src/js/utils/polyfill.ts @@ -0,0 +1,3 @@ +if (!top._babelPolyfill) { + require('babel-polyfill'); +} diff --git a/webpack.config.ts b/webpack.config.ts index 9f5d34f2..c4dab40a 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -61,7 +61,7 @@ const config: webpack.Configuration = { 'js/worker': ['babel-polyfill', './src/js/worker/worker'], 'js/frontend': ['babel-polyfill', './src/js/frontend'], 'js/reference-list/index': [ - 'babel-polyfill', + './src/js/utils/polyfill', 'whatwg-fetch', 'raf/polyfill', './src/js/reference-list/',