A CRACO plugin that allows you to rewire the babel-loader in your un-ejected create-react-app project to include or exclude custom paths (e.g., from node_modules) for transpilation. Version 1.0.4 is the latest stable release, supporting both @craco/craco v6 and v7. It fills a gap for CRA v2+ by enabling babel transpilation of external packages, which is especially useful for monorepos or when using ES6+ libraries from npm. Compared to alternatives like react-app-rewired, this plugin integrates directly with CRACO's configuration system and provides a simpler include/exclude API.
npm install craco-babel-loaderVerified import paths — ran on the pinned version, not inferred.
Shows how to add craco-babel-loader as a plugin in a CRACO config file, specifying which node_modules directories to include or exclude from babel transpilation.
Ensure @craco/craco is at least version 6.4.2 or 7.0.0.
Use only with CRA + CRACO; for react-app-rewired, use react-app-rewire-babel-loader.
Always provide an array for includes/excludes: includes: ['/path'].
Monitor babel-loader updates; consider switching to @craco/craco's built-in babel configuration if possible.
Run 'npm install craco-babel-loader' or 'yarn add craco-babel-loader'.
Use 'const rewireBabelLoader = require("craco-babel-loader");' and pass it as { plugin: rewireBabelLoader }.Wrap the path in an array: includes: [resolveApp('path/to/include')].