Commit 2a4a5923 authored by jakeburden's avatar jakeburden

Set babel to utilize `useBuiltIns: "usage”`

Removes explict calls to core-js polyfills.
Lets babel find polyfills when needed for our target browsers.
parent 87cdcfa4
// ECMAScript polyfills
import 'core-js/es/array/fill';
import 'core-js/es/array/find';
import 'core-js/es/array/find-index';
import 'core-js/es/array/from';
import 'core-js/es/array/includes';
import 'core-js/es/number/is-integer';
import 'core-js/es/object/assign';
import 'core-js/es/object/values';
import 'core-js/es/object/entries';
import 'core-js/es/promise';
import 'core-js/es/promise/finally';
import 'core-js/es/string/code-point-at';
import 'core-js/es/string/from-code-point';
import 'core-js/es/string/includes';
import 'core-js/es/string/starts-with';
import 'core-js/es/string/ends-with';
import 'core-js/es/symbol';
import 'core-js/es/map';
import 'core-js/es/weak-map';
import 'core-js/modules/web.url';
// Browser polyfills // Browser polyfills
import 'formdata-polyfill'; import 'formdata-polyfill';
import './polyfills/custom_event'; import './polyfills/custom_event';
......
// co-locating ensure_single_line to satisfy static analysis while allowing Node.js to import the function with CommonJS
import ensureSingleLine from '../ensure_single_line';
export default ensureSingleLine;
import Jed from 'jed'; import Jed from 'jed';
import ensureSingleLine from './ensure_single_line'; import ensureSingleLine from './es6/ensure_single_line';
import sprintf from './sprintf'; import sprintf from './sprintf';
const languageCode = () => document.querySelector('html').getAttribute('lang') || 'en'; const languageCode = () => document.querySelector('html').getAttribute('lang') || 'en';
......
import 'core-js/es/map';
import 'core-js/es/set';
import { Sortable } from 'sortablejs'; import { Sortable } from 'sortablejs';
import simulateDrag from './simulate_drag'; import simulateDrag from './simulate_drag';
import simulateInput from './simulate_input'; import simulateInput from './simulate_input';
......
...@@ -6,6 +6,8 @@ const presets = [ ...@@ -6,6 +6,8 @@ const presets = [
[ [
'@babel/preset-env', '@babel/preset-env',
{ {
useBuiltIns: 'usage',
corejs: { version: 3, proposals: true },
modules: false, modules: false,
targets: { targets: {
ie: '11', ie: '11',
...@@ -51,4 +53,4 @@ if (isJest) { ...@@ -51,4 +53,4 @@ if (isJest) {
plugins.push('babel-plugin-dynamic-import-node'); plugins.push('babel-plugin-dynamic-import-node');
} }
module.exports = { presets, plugins }; module.exports = { presets, plugins, sourceType: 'unambiguous' };
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
"webpack-prod": "NODE_OPTIONS=\"--max-old-space-size=3584\" NODE_ENV=production webpack --config config/webpack.config.js" "webpack-prod": "NODE_OPTIONS=\"--max-old-space-size=3584\" NODE_ENV=production webpack --config config/webpack.config.js"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.6.2", "@babel/core": "^7.7.5",
"@babel/plugin-proposal-class-properties": "^7.5.5", "@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-json-strings": "^7.2.0", "@babel/plugin-proposal-json-strings": "^7.2.0",
"@babel/plugin-proposal-optional-chaining": "^7.7.5", "@babel/plugin-proposal-optional-chaining": "^7.7.5",
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
"codesandbox-api": "^0.0.20", "codesandbox-api": "^0.0.20",
"compression-webpack-plugin": "^3.0.1", "compression-webpack-plugin": "^3.0.1",
"copy-webpack-plugin": "^5.0.5", "copy-webpack-plugin": "^5.0.5",
"core-js": "^3.2.1", "core-js": "^3.4.0",
"cropper": "^2.3.0", "cropper": "^2.3.0",
"css-loader": "^1.0.0", "css-loader": "^1.0.0",
"d3": "^4.13.0", "d3": "^4.13.0",
...@@ -210,4 +210,4 @@ ...@@ -210,4 +210,4 @@
"node": ">=8.10.0", "node": ">=8.10.0",
"yarn": "^1.10.0" "yarn": "^1.10.0"
} }
} }
\ No newline at end of file
import ensureSingleLine from '~/locale/ensure_single_line'; import ensureSingleLine from '~/locale/es6/ensure_single_line';
describe('locale', () => { describe('locale', () => {
describe('ensureSingleLine', () => { describe('ensureSingleLine', () => {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment