use a Set
This commit is contained in:
parent
a48cf8b53f
commit
88d4df437e
@ -243,7 +243,10 @@ export default function buildPreset(context, opts = {}) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (useBuiltIns === true) {
|
if (useBuiltIns === true) {
|
||||||
plugins.push([addUsedBuiltInsPlugin, { polyfills, regenerator, debug }]);
|
plugins.push([
|
||||||
|
addUsedBuiltInsPlugin,
|
||||||
|
{ polyfills: new Set(polyfills), regenerator, debug },
|
||||||
|
]);
|
||||||
} else if (useBuiltIns === "entry") {
|
} else if (useBuiltIns === "entry") {
|
||||||
plugins.push([useBuiltInsEntryPlugin, { polyfills, regenerator }]);
|
plugins.push([useBuiltInsEntryPlugin, { polyfills, regenerator }]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,12 +38,12 @@ export default function({ types: t }) {
|
|||||||
function addUnsupported(path, polyfills, builtIn, builtIns) {
|
function addUnsupported(path, polyfills, builtIn, builtIns) {
|
||||||
if (Array.isArray(builtIn)) {
|
if (Array.isArray(builtIn)) {
|
||||||
for (const i of builtIn) {
|
for (const i of builtIn) {
|
||||||
if (polyfills.indexOf(i) !== -1) {
|
if (polyfills.has(i)) {
|
||||||
addImport(path, `core-js/modules/${i}`, builtIns);
|
addImport(path, `core-js/modules/${i}`, builtIns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (polyfills.indexOf(builtIn) !== -1) {
|
if (polyfills.has(builtIn)) {
|
||||||
addImport(path, `core-js/modules/${builtIn}`, builtIns);
|
addImport(path, `core-js/modules/${builtIn}`, builtIns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user