Maintain plugin order with items in the include option (#6663)
This commit is contained in:
parent
6a19c2299a
commit
f3fd2ee3b2
@ -235,7 +235,7 @@ An array of plugins to always include.
|
||||
|
||||
Valid options include any:
|
||||
|
||||
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) - names without a prefix like `transform-spread` instead of `plugin-transform-spread` are supported.
|
||||
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js), names without a prefix like `transform-spread` instead of `plugin-transform-spread` are supported. Note, that none of the module transforms (`transform-module-*`) are supported here, use the [`modules` option](https://github.com/babel/babel/tree/master/experimental/babel-preset-env#modules) instead.
|
||||
|
||||
- [Built-ins](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js), such as `map`, `set`, or `object.assign`.
|
||||
|
||||
|
||||
@ -121,17 +121,16 @@ const filterItems = (
|
||||
const result = new Set();
|
||||
|
||||
for (const item in list) {
|
||||
const excluded = excludes.has(item);
|
||||
if (
|
||||
!excludes.has(item) &&
|
||||
(isPluginRequired(targets, list[item]) || includes.has(item))
|
||||
) {
|
||||
result.add(item);
|
||||
} else {
|
||||
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
|
||||
|
||||
if (!excluded) {
|
||||
if (isPluginRequired(targets, list[item])) {
|
||||
result.add(item);
|
||||
} else {
|
||||
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
|
||||
|
||||
if (shippedProposalsSyntax) {
|
||||
result.add(shippedProposalsSyntax);
|
||||
}
|
||||
if (shippedProposalsSyntax) {
|
||||
result.add(shippedProposalsSyntax);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -140,8 +139,6 @@ const filterItems = (
|
||||
defaultItems.forEach(item => !excludes.has(item) && result.add(item));
|
||||
}
|
||||
|
||||
includes.forEach(item => result.add(item));
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import "core-js/modules/es6.map";
|
||||
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";
|
||||
import "core-js/modules/es6.map";
|
||||
|
||||
async function a() {
|
||||
await 1;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import "core-js/modules/es6.map";
|
||||
import "core-js/modules/es6.set";
|
||||
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";
|
||||
import "core-js/modules/es6.map";
|
||||
import "core-js/modules/es6.set";
|
||||
|
||||
@ -1 +1 @@
|
||||
import a from "a";
|
||||
class Foo {}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
"use strict";
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var _a = _interopRequireDefault(require("a"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
let Foo = function Foo() {
|
||||
_classCallCheck(this, Foo);
|
||||
};
|
||||
|
||||
@ -1,8 +1,10 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../../../lib", {
|
||||
"targets": {},
|
||||
"include": ["transform-modules-commonjs"],
|
||||
"targets": {
|
||||
"chrome": 61
|
||||
},
|
||||
"include": ["transform-classes"],
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user