Skip to content

Commit

Permalink
Fix lower target babel transpilation (#127)
Browse files Browse the repository at this point in the history
Co-authored-by: janniks <janniks@users.noreply.github.com>
  • Loading branch information
janniks and janniks authored Feb 19, 2023
1 parent 6b68704 commit 342785e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
current node
node 12
last 2 versions and > 2%
ie > 10
13 changes: 1 addition & 12 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -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,
};
22 changes: 1 addition & 21 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, "..");
Expand Down Expand Up @@ -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"],
}),
],
};
Expand Down

1 comment on commit 342785e

@vercel
Copy link

@vercel vercel bot commented on 342785e Feb 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.