Remove Babel from library build pipeline

The rollup build already uses @rollup/plugin-typescript for type
stripping and JSX. Babel was running after it as a no-op for modern
targets. Now Babel is only used by Jest for ESM→CJS conversion.

Also removes @babel/preset-env since it's no longer needed.
Bundle size decreased by ~1.7KB.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jordan Eldredge 2026-06-07 11:54:42 -07:00
parent a901afcff9
commit 41d6ae0568
4 changed files with 2 additions and 72 deletions

View file

@ -1,33 +1,4 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"last 2 Chrome versions",
"last 2 ChromeAndroid versions",
"last 2 Safari versions",
"last 2 Firefox versions",
"last 2 Edge versions",
"last 2 iOS versions",
"last 2 Opera versions"
]
}
}
],
// TODO: Can TypeScript just do this for us?
"@babel/preset-typescript"
],
"plugins": [],
"env": {
"test": {
"plugins": [
"@babel/plugin-transform-modules-commonjs"
]
},
"library": {
"plugins": ["@babel/plugin-transform-runtime"]
}
}
"presets": ["@babel/preset-typescript"],
"plugins": ["@babel/plugin-transform-modules-commonjs"]
}

View file

@ -75,8 +75,6 @@
"ani-cursor": "workspace:*",
"milkdrop-preset-converter-aws": "^0.1.6",
"winamp-eqf": "workspace:*",
"@babel/preset-env": "^7.25.0",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.8",
"@rollup/plugin-json": "^6.1.0",
"@rollup/plugin-node-resolve": "^15.2.3",

View file

@ -8,7 +8,6 @@ import { visualizer } from "rollup-plugin-visualizer";
import replace from "@rollup/plugin-replace";
import postcssOptimizeDataUriPngs from "./postcss-optimize-data-uri-pngs.mjs";
import atImport from "postcss-import";
import { babel } from "@rollup/plugin-babel";
import nodePolyfills from "rollup-plugin-polyfill-node";
import path from "node:path";
@ -55,14 +54,6 @@ export function getPlugins({ minify, outputFile, vite }) {
// Without this we get: Error: 'default' is not exported by node_modules/react/index.js
// because react-redux import react as if it were an es6 module, but it is not.
commonjs(),
// Must come after commonjs
babel({
babelHelpers: "bundled",
compact: minify,
// Optimize Babel by excluding node_modules and only processing necessary files
exclude: ["node_modules/**"],
include: ["js/**/*"],
}),
minify
? terser({
compress: {

30
pnpm-lock.yaml generated
View file

@ -381,12 +381,6 @@ importers:
specifier: ^1.2.3
version: 1.2.3
devDependencies:
'@babel/preset-env':
specifier: ^7.25.0
version: 7.27.2(@babel/core@7.27.4)
'@rollup/plugin-babel':
specifier: ^6.0.4
version: 6.0.4(@babel/core@7.27.4)(@types/babel__core@7.20.5)(rollup@4.18.0)
'@rollup/plugin-commonjs':
specifier: ^25.0.8
version: 25.0.8(rollup@4.18.0)
@ -3118,19 +3112,6 @@ packages:
resolution: {integrity: sha512-GFGDywRwGbuGq9yeL8wTjjLOsZ5Ps4O5tQ71eDcAfaZrZeA7Oe8QJzrnmFgplWtnoaBIBaFBB3n5Ht9iU4jLLw==}
engines: {node: '>=12.0.0'}
'@rollup/plugin-babel@6.0.4':
resolution: {integrity: sha512-YF7Y52kFdFT/xVSuVdjkV5ZdX/3YtmX0QulG+x0taQOtJdHYzVU61aSSkAgVJ7NOv6qPkIYiJSgSWWN/DM5sGw==}
engines: {node: '>=14.0.0'}
peerDependencies:
'@babel/core': ^7.0.0
'@types/babel__core': ^7.1.9
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
'@types/babel__core':
optional: true
rollup:
optional: true
'@rollup/plugin-commonjs@16.0.0':
resolution: {integrity: sha512-LuNyypCP3msCGVQJ7ki8PqYdpjfEkE/xtFa5DqlF+7IBD0JsfMZ87C58heSwIMint58sAUZbt3ITqOmdQv/dXw==}
engines: {node: '>= 8.0.0'}
@ -16745,17 +16726,6 @@ snapshots:
'@rgrove/parse-xml@3.0.0': {}
'@rollup/plugin-babel@6.0.4(@babel/core@7.27.4)(@types/babel__core@7.20.5)(rollup@4.18.0)':
dependencies:
'@babel/core': 7.27.4
'@babel/helper-module-imports': 7.27.1
'@rollup/pluginutils': 5.1.0(rollup@4.18.0)
optionalDependencies:
'@types/babel__core': 7.20.5
rollup: 4.18.0
transitivePeerDependencies:
- supports-color
'@rollup/plugin-commonjs@16.0.0(rollup@2.37.1)':
dependencies:
'@rollup/pluginutils': 3.1.0(rollup@2.37.1)