From 342785e19d08b606d6424fce5c82669519be5f57 Mon Sep 17 00:00:00 2001 From: janniks <6362150+janniks@users.noreply.github.com> Date: Sun, 19 Feb 2023 16:52:48 +0100 Subject: [PATCH] Fix lower target babel transpilation (#127) Co-authored-by: janniks --- .browserslistrc | 2 +- babel.config.js | 13 +------------ build/rollup.config.js | 22 +--------------------- 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/.browserslistrc b/.browserslistrc index b29aeba..c3c4766 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,3 +1,3 @@ -current node +node 12 last 2 versions and > 2% ie > 10 diff --git a/babel.config.js b/babel.config.js index 6322ed4..8a0ca19 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,16 +1,5 @@ const devPresets = ["@vue/babel-preset-app"]; -const buildPresets = [ - [ - "@babel/preset-env", - // Config for @babel/preset-env - { - // Example: Always transpile optional chaining/nullish coalescing - // include: [ - // /(optional-chaining|nullish-coalescing)/ - // ], - }, - ], -]; +const buildPresets = [["@babel/preset-env"]]; module.exports = { presets: process.env.NODE_ENV === "development" ? devPresets : buildPresets, }; diff --git a/build/rollup.config.js b/build/rollup.config.js index 91675be..33953b9 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -10,18 +10,6 @@ import babel from "@rollup/plugin-babel"; import { terser } from "rollup-plugin-terser"; import minimist from "minimist"; -// Get browserslist config and remove ie from es build targets -const esbrowserslist = fs - .readFileSync("./.browserslistrc") - .toString() - .split("\n") - .filter((entry) => entry && entry.substring(0, 2) !== "ie"); - -// Extract babel preset-env config, to combine with esbrowserslist -const babelPresetEnvConfig = require("../babel.config").presets.filter( - (entry) => entry[0] === "@babel/preset-env" -)[0][1]; - const argv = minimist(process.argv.slice(2)); const projectRoot = path.resolve(__dirname, ".."); @@ -98,15 +86,7 @@ if (!argv.format || argv.format === "es") { ...baseConfig.plugins.postVue, babel({ ...baseConfig.plugins.babel, - presets: [ - [ - "@babel/preset-env", - { - ...babelPresetEnvConfig, - targets: esbrowserslist, - }, - ], - ], + presets: ["@babel/preset-env"], }), ], };