Registry / devops / babel-load-config

babel-load-config

JSON →
library1.0.0jsnpmunverified

A utility that loads Babel configuration using the same method as babel-core, enabling you to resolve and parse .babelrc files programmatically. Version 1.0.0 is the latest stable release. It requires babel-core as a peer dependency. The package is deprecated in favor of using @babel/core's built-in config loading APIs.

npm install babel-load-config
INSTALL
IMPORT
SIG · BABEL-LOAD-CONFIG
B
babel-load-config
devopsjavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const loadConfig = require('babel-load-config')
import loadConfig from 'babel-load-config'
Package does not provide ESM exports; use CommonJS require.

Demonstrates how to load .babelrc configuration from a directory using babel-load-config.

const loadConfig = require('babel-load-config'); const buildConfigChain = require('babel-core/lib/transformation/file/options/build-config-chain'); const config = loadConfig(process.cwd(), buildConfigChain); console.log(config); // Output: { loc: '/path/.babelrc', options: { presets: [] } }
Debug
Known issues
deprecatedbabel-load-config is deprecated. Use @babel/core's config loading instead.
fix
Use @babel/core's loadPartialConfig or loadFullConfig APIs.
affects: >=1.0.0
gotchababel-load-config depends on babel-core internal module 'build-config-chain' which may change across babel versions.
fix
Pin babel-core version to a known compatible version.
affects: >=1.0.0
gotchaThe function expects a callback to the internal buildConfigChain, which is not a public API.
fix
Pass the babel-core internal build-config-chain module as second argument.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'babel-core/lib/transformation/file/options/build-config-chain'
The babel-core version does not have that internal module path (e.g., Babel v7+ uses @babel/core with different internals).
fix
Use @babel/core and call loadPartialConfig directly instead of this package.
TypeError: loadConfig is not a function
Using ES import syntax on a CommonJS-only package.
fix
Use require('babel-load-config') instead of import.
Error: Cannot find module 'babel-core'
babel-core is not installed as a peer dependency.
fix
npm install babel-core
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
babel-corerequiredPeer dependency; the package relies on babel-core's internal config chain builder.
Agent activity
8 hits · last 30 days
node
6
Resources
babel-load-config — npm install babel-load-config · libregistry