Add core-js as valid polyfill source (#7315)

This commit is contained in:
Daniel Tschinder
2018-02-05 00:53:54 +01:00
committed by Brian Ng
parent 7234442fde
commit 593c1a0861
6 changed files with 21 additions and 2 deletions

View File

@@ -342,6 +342,8 @@ import "core-js/modules/es7.string.pad-start";
import "core-js/modules/es7.string.pad-end";
```
This will also work for `core-js` directly (`import "core-js";` or `require('core-js');`)
#### `useBuiltIns: false`
Don't add polyfills automatically per file, or transform `import "@babel/polyfill"` to individual polyfills.

View File

@@ -86,7 +86,7 @@ export const filterStageFromList = (list: any, stageList: any) => {
};
export const isPolyfillSource = (source: string): boolean =>
source === "@babel/polyfill";
source === "@babel/polyfill" || source === "core-js";
export const isRequire = (t: Object, path: Object): boolean =>
t.isExpressionStatement(path.node) &&

View File

@@ -0,0 +1 @@
import "core-js";

View File

@@ -0,0 +1,11 @@
{
"presets": [
["../../../../lib", {
"targets": {
"chrome": 55
},
"modules": false,
"useBuiltIns": "entry"
}]
]
}

View File

@@ -0,0 +1,6 @@
import "core-js/modules/es6.array.sort";
import "core-js/modules/es7.string.pad-start";
import "core-js/modules/es7.string.pad-end";
import "core-js/modules/web.timers";
import "core-js/modules/web.immediate";
import "core-js/modules/web.dom.iterable";

View File

@@ -1 +0,0 @@
import "core-js";