Registry / devops / react-app-rewire-babel-loader

react-app-rewire-babel-loader

JSON →
library0.1.1jsnpmunverified

A utility for use with react-app-rewired to allow customization of the babel-loader configuration in create-react-app projects without ejecting. Current stable version is 0.1.1, released with no further updates. It provides two functions, include and exclude, to add or remove npm modules from the babel-loader pipeline. This is a niche tool for developers who need to transpile specific node_modules packages that are not ES5, which create-react-app's default configuration excludes. No known alternatives for this specific purpose.

npm install react-app-rewire-babel-loader
INSTALL
IMPORT
SIG · REACT-APP-REWIRE-B
R
react-app-rewire-babel-loader
devopsjavascriptv0.1.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

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

include
const { include } = require('react-app-rewire-babel-loader');
import { include } from 'react-app-rewire-babel-loader';
This package does not support ES module imports. Use CommonJS require.
exclude
const { exclude } = require('react-app-rewire-babel-loader');
const exclude = require('react-app-rewire-babel-loader/exclude');
Both functions are exported from the main entry; no subpath exports.
default
const rewireBabelLoader = require('react-app-rewire-babel-loader');
import rewireBabelLoader from 'react-app-rewire-babel-loader';
Default export is an object with include and exclude methods.

Shows how to use include and exclude to customize babel-loader in CRA without ejecting.

// config-overrides.js const path = require('path'); const fs = require('fs'); const rewireBabelLoader = require('react-app-rewire-babel-loader'); const appDirectory = fs.realpathSync(process.cwd()); const resolveApp = relativePath => path.resolve(appDirectory, relativePath); module.exports = function override(config, env) { // Include a specific npm module in babel transpilation config = rewireBabelLoader.include( config, resolveApp('node_modules/some-es6-package') ); // Exclude node_modules from babel (default CRA behavior) config = rewireBabelLoader.exclude( config, /(node_modules|bower_components)/ ); return config; };
Debug
Known issues
breakingRequires react-app-rewired to be installed and configured. Without it, this package does nothing.
fix
Ensure react-app-rewired is installed and config-overrides.js is set up correctly.
affects: >=0.1.0
deprecatedPackage is no longer maintained and may not work with latest create-react-app versions.
fix
Consider using craco or ejecting to customize webpack.
affects: >=0.1.0
gotchaThe include path must be an absolute path to the npm module's directory; relative paths will fail.
fix
Use path.resolve to get absolute path, e.g., path.resolve('node_modules/package').
affects: >=0.1.0
Errors
Common errors & fixes
Module not found: Can't resolve 'react-app-rewire-babel-loader'
The package is not installed or is not in the correct location.
fix
Run: npm install react-app-rewire-babel-loader --save-dev
TypeError: rewireBabelLoader.include is not a function
Using ES module import syntax with this CommonJS-only package.
fix
Change to: const rewireBabelLoader = require('react-app-rewire-babel-loader');
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
react-app-rewiredrequiredRequired to override create-react-app's webpack configuration.
babel-loaderrequiredThe webpack loader being rewireed; must be present in the project.
Agent activity
11 hits · last 30 days
node
10
Amazon
1
Resources
react-app-rewire-babel-loader — npm install react-app-rewire-babel-loader · libregistry