Normalize core-js entry points (#9752)
* normalize `core-js` entry points names * Update packages/babel-preset-env/src/polyfills/corejs3/entry-plugin.js Co-Authored-By: zloirock <zloirock@zloirock.ru> * handle windows paths
This commit is contained in:
parent
ef0722b4b2
commit
adb4701e00
@ -21,6 +21,12 @@ function isBabelPolyfillSource(source) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isCoreJSSource(source) {
|
function isCoreJSSource(source) {
|
||||||
|
if (typeof source === "string") {
|
||||||
|
source = source
|
||||||
|
.replace(/\\/g, "/")
|
||||||
|
.replace(/(\/(index)?)?(\.js)?$/i, "")
|
||||||
|
.toLowerCase();
|
||||||
|
}
|
||||||
return has(corejsEntries, source) && corejsEntries[source];
|
return has(corejsEntries, source) && corejsEntries[source];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
7
packages/babel-preset-env/test/fixtures/corejs3/entry-normalization/input.mjs
vendored
Normal file
7
packages/babel-preset-env/test/fixtures/corejs3/entry-normalization/input.mjs
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
import 'core-js/es/map/index.js';
|
||||||
|
import 'core-js/es/set/index';
|
||||||
|
import 'core-js/es/array/from.js';
|
||||||
|
import 'core-js/es/promise/';
|
||||||
|
import 'cOrE-jS/eS/SymBOL/iTERator';
|
||||||
|
import 'core-js\\es\\symbol\\async-iterator';
|
||||||
|
import 'foo/index.js';
|
||||||
12
packages/babel-preset-env/test/fixtures/corejs3/entry-normalization/options.json
vendored
Normal file
12
packages/babel-preset-env/test/fixtures/corejs3/entry-normalization/options.json
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"../../../../lib",
|
||||||
|
{
|
||||||
|
"modules": false,
|
||||||
|
"useBuiltIns": "entry",
|
||||||
|
"corejs": 3
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
11
packages/babel-preset-env/test/fixtures/corejs3/entry-normalization/output.mjs
vendored
Normal file
11
packages/babel-preset-env/test/fixtures/corejs3/entry-normalization/output.mjs
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import "core-js/modules/es.symbol.async-iterator";
|
||||||
|
import "core-js/modules/es.symbol.iterator";
|
||||||
|
import "core-js/modules/es.array.from";
|
||||||
|
import "core-js/modules/es.map";
|
||||||
|
import "core-js/modules/es.object.to-string";
|
||||||
|
import "core-js/modules/es.promise";
|
||||||
|
import "core-js/modules/es.promise.finally";
|
||||||
|
import "core-js/modules/es.set";
|
||||||
|
import "core-js/modules/es.string.iterator";
|
||||||
|
import "core-js/modules/web.dom-collections.iterator";
|
||||||
|
import 'foo/index.js';
|
||||||
Loading…
x
Reference in New Issue
Block a user