diff --git a/lib/plugins.js b/lib/plugins.js index 4a8b357..d8d1fe3 100644 --- a/lib/plugins.js +++ b/lib/plugins.js @@ -20,7 +20,7 @@ function _default(api, opts) { systemjs: require.resolve("@babel/plugin-transform-modules-systemjs") }; var modulePlugin = modulesMap[modules] && [modulesMap[modules], { - strictMode: strictMode + strictMode }]; // class-properties 开启 `loose` 后 private-methods 也要同时开启 return [// useFlow && [ @@ -38,22 +38,19 @@ function _default(api, opts) { // modules: amd => Promise.resolve.then( () => require([path], callback) ) // ... require.resolve("@babel/plugin-syntax-dynamic-import"), require.resolve("@babel/plugin-proposal-async-generator-functions"), [require.resolve("@babel/plugin-proposal-decorators"), { - decoratorsBeforeExport: decoratorsBeforeExport, + decoratorsBeforeExport, legacy: false }], // Enable loose mode to use assignment instead of defineProperty [require.resolve("@babel/plugin-proposal-class-properties"), { loose: true }], [require.resolve("@babel/plugin-proposal-private-methods"), { loose: true - }], require.resolve("@babel/plugin-proposal-do-expressions"), require.resolve("@babel/plugin-proposal-export-default-from"), require.resolve("@babel/plugin-proposal-export-namespace-from"), require.resolve("@babel/plugin-proposal-function-bind"), require.resolve("@babel/plugin-proposal-function-sent"), require.resolve("@babel/plugin-proposal-logical-assignment-operators"), require.resolve("@babel/plugin-proposal-nullish-coalescing-operator"), require.resolve("@babel/plugin-proposal-numeric-separator"), require.resolve("@babel/plugin-proposal-optional-chaining"), // require.resolve("@babel/plugin-proposal-partial-application"), - require.resolve("@babel/plugin-proposal-throw-expressions"), require.resolve("@babel/plugin-proposal-optional-catch-binding"), [require.resolve("@babel/plugin-proposal-object-rest-spread"), { + }], require.resolve("@babel/plugin-proposal-do-expressions"), require.resolve("@babel/plugin-proposal-export-default-from"), require.resolve("@babel/plugin-proposal-export-namespace-from"), require.resolve("@babel/plugin-proposal-function-bind"), require.resolve("@babel/plugin-proposal-function-sent"), require.resolve("@babel/plugin-proposal-nullish-coalescing-operator"), require.resolve("@babel/plugin-proposal-numeric-separator"), require.resolve("@babel/plugin-proposal-optional-chaining"), require.resolve("@babel/plugin-proposal-optional-catch-binding"), [require.resolve("@babel/plugin-proposal-object-rest-spread"), { // 使用Object.assign代替babel的helper方法 loose: true, useBuiltIns: true }], require.resolve("@babel/plugin-syntax-top-level-await"), // require.resolve("@babel/plugin-transform-react-jsx"), // require.resolve("@babel/plugin-transform-proto-to-assign"), //Internet Explorer(10 and below) - [require.resolve("@babel/plugin-proposal-pipeline-operator"), { - proposal: "minimal" - }], runtimeOptions && [require.resolve("@babel/plugin-transform-runtime"), runtimeOptions], require.resolve("babel-plugin-dev-expression"), //Replaces __DEV__ with process.env.NODE_ENV !== 'production' + runtimeOptions && [require.resolve("@babel/plugin-transform-runtime"), runtimeOptions], require.resolve("babel-plugin-dev-expression"), //Replaces __DEV__ with process.env.NODE_ENV !== 'production' modulePlugin].filter(Boolean); } \ No newline at end of file