arco-scripts-babel-config
raw JSON → 1.0.0 verified Sat Apr 25 auth: no javascript
A shared Babel configuration package used internally by Arco scripts (from the Arco Design team) for compiling modern JavaScript/TypeScript. Version 1.0.0 is the initial stable release. It provides a preset-based setup optimized for React/TypeScript projects, typically consumed via `@arco-design/arco-scripts`. Requires `@babel/core` and related Babel plugins as peer dependencies. Key differentiators: tightly coupled with the Arco ecosystem; no standalone usage intended; minimal configuration overhead for Arco-based projects.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported. ↓
cause Using require() on an ESM-only package.
fix
Change to import or use dynamic import().
error TypeError: Cannot read properties of undefined (reading 'presets') ↓
cause Babel config not correctly applied after importing.
fix
Ensure the config object is passed as module.exports in babel.config.js.
Warnings
gotcha Package is ESM-only and cannot be required with CommonJS require(). ↓
fix Use dynamic import() or ensure your project is set to ESM.
gotcha This package is intended for internal use by Arco scripts; standalone usage may lead to unexpected behavior. ↓
fix Use within an Arco Design project or fork the config.
deprecated No breaking changes yet; version 1.0.0 is initial. Be aware that future versions may change export shapes. ↓
fix Pin version and check release notes before upgrading.
Install
npm install arco-scripts-babel-config yarn add arco-scripts-babel-config pnpm add arco-scripts-babel-config Imports
- default wrong
const babelConfig = require('arco-scripts-babel-config')correctimport babelConfig from 'arco-scripts-babel-config' - BabelConfig wrong
import { BabelConfig } from 'arco-scripts-babel-config'correctimport type { BabelConfig } from 'arco-scripts-babel-config' - getBabelConfig
import { getBabelConfig } from 'arco-scripts-babel-config'
Quickstart
import babelConfig from 'arco-scripts-babel-config';
// In .babelrc or babel.config.js:
module.exports = babelConfig;
// Or with options:
import { getBabelConfig } from 'arco-scripts-babel-config';
const config = getBabelConfig({ targets: '> 0.25%, not dead' });