Switch to core-js for polyfills

This commit is contained in:
Quincy Morgan
2020-10-13 16:02:26 -04:00
parent 02dd7f17c0
commit e15aeda221
4 changed files with 13 additions and 9 deletions

View File

@@ -2,6 +2,8 @@
"presets": [
[
"@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": 3,
"modules": false
}
]

View File

@@ -29,7 +29,9 @@ export default {
commonjs(),
json({ indent: '' }),
babel({
babelHelpers: 'bundled'
babelHelpers: 'bundled',
// avoid circular dependencies due to `useBuiltIns: usage` option
exclude: [/\/core-js\//]
})
]
};

View File

@@ -1,10 +1,12 @@
import 'browser-polyfills';
import 'es6-symbol/implement';
// polyfills newer JS functionality for older browsers
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'string.fromcodepoint/auto';
// polyfill window.fetch and AbortController (not included in core-js)
import 'whatwg-fetch';
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
// polyfill requestIdleCallback
// polyfill idle callback functions (not included in core-js)
window.requestIdleCallback = window.requestIdleCallback ||
function(cb) {
var start = Date.now();
@@ -17,7 +19,6 @@ window.requestIdleCallback = window.requestIdleCallback ||
});
});
};
window.cancelIdleCallback = window.cancelIdleCallback ||
function(id) {
window.cancelAnimationFrame(id);

View File

@@ -50,9 +50,8 @@
"abortcontroller-polyfill": "^1.4.0",
"aes-js": "^3.1.2",
"alif-toolkit": "^1.2.9",
"browser-polyfills": "~1.5.0",
"core-js": "^3.6.5",
"diacritics": "1.3.0",
"es6-symbol": "^3.1.3",
"fast-deep-equal": "~3.1.1",
"fast-json-stable-stringify": "2.1.0",
"lodash-es": "~4.17.15",
@@ -63,7 +62,7 @@
"pannellum": "2.5.6",
"rbush": "3.0.1",
"regenerator-runtime": "^0.13.7",
"string.fromcodepoint": "1.0.0",
"whatwg-fetch": "^3.4.1",
"which-polygon": "2.2.0"
},
"devDependencies": {