{"id":19422,"library":"craco-babel-loader-plugin","title":"CRACO Babel Loader Plugin","description":"craco-babel-loader-plugin v1.0.3 is a CRACO plugin that allows overriding babel-loader configuration in Create React App projects to transpile dependencies (e.g., ES6+ or TypeScript) from node_modules or monorepo siblings. It is an updated fork of craco-babel-loader with TypeScript migration and latest @craco/craco support. Unlike alternatives, it provides explicit include/exclude options. Release cadence is low; last update May 2021.","status":"maintenance","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/AlexandruCalinica/craco-babel-loader-plugin","tags":["javascript","babel-loader","craco","webpack","@craco/craco","craco-babel-loader-plugin","craco-babel-loader","create-react-app"],"install":[{"cmd":"npm install craco-babel-loader-plugin","lang":"bash","label":"npm"},{"cmd":"yarn add craco-babel-loader-plugin","lang":"bash","label":"yarn"},{"cmd":"pnpm add craco-babel-loader-plugin","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency; plugin is meant to be used as a CRACO plugin.","package":"@craco/craco","optional":false}],"imports":[{"note":"Plugin is CommonJS only; ESM import will fail. Use require() in craco.config.js.","wrong":"import rewireBabelLoader from 'craco-babel-loader-plugin';","symbol":"rewireBabelLoader","correct":"const rewireBabelLoader = require('craco-babel-loader-plugin');"},{"note":"Must wrap in an object with plugin and options keys; passing the function directly won't work.","wrong":"module.exports = { plugins: [ rewireBabelLoader ] };","symbol":"plugin (via craco.config.js)","correct":"module.exports = { plugins: [{ plugin: rewireBabelLoader, options: {...} }] };"},{"note":"v1.0.0+ uses a default export; if require returns an object with .default, use that. Check package type.","wrong":"const rewireBabelLoader = require('craco-babel-loader-plugin');","symbol":"default export","correct":"const rewireBabelLoader = require('craco-babel-loader-plugin').default;"}],"quickstart":{"code":"// craco.config.js\nconst path = require('path');\nconst fs = require('fs');\nconst rewireBabelLoader = require('craco-babel-loader-plugin');\n\nconst appDirectory = fs.realpathSync(process.cwd());\nconst resolveApp = relativePath => path.resolve(appDirectory, relativePath);\n\nmodule.exports = {\n  plugins: [\n    {\n      plugin: rewireBabelLoader,\n      options: {\n        includes: [resolveApp('node_modules/isemail')],\n        excludes: [/(node_modules|bower_components)/]\n      }\n    }\n  ]\n};","lang":"javascript","description":"Shows how to configure craco-babel-loader-plugin to transpile the isemail module from node_modules while keeping other node_modules excluded."},"warnings":[{"fix":"Use const rewireBabelLoader = require('craco-babel-loader-plugin').default;","message":"v1.0.0 changed to default export; require() returns { default: pluginFn }.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use path.resolve or fs.realpathSync to construct absolute paths before passing to includes/excludes.","message":"Options.includes and options.excludes must be absolute paths or regex. Relative paths will not resolve correctly.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Switch to craco-babel-loader-plugin v1.x.","message":"Original craco-babel-loader is unmaintained; this fork is the recommended replacement.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Check @craco/craco compatibility with your react-scripts version.","message":"react-scripts version must be compatible with @craco/craco; CRA 4 is supported but CRA 5 may break.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Types are included; if missing, install @types/craco-babel-loader-plugin or define custom types.","message":"First release (1.0.0) migrated from Flow to TypeScript; TypeScript users should check types.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install craco-babel-loader-plugin --save-dev","cause":"Missing install or incorrect require path.","error":"Error: Cannot find module 'craco-babel-loader-plugin'"},{"fix":"Use const rewireBabelLoader = require('craco-babel-loader-plugin').default;","cause":"Using import statement or incorrect require result structure.","error":"TypeError: rewireBabelLoader is not a function"},{"fix":"Ensure you have babel-loader installed: npm install babel-loader --save-dev","cause":"babel-loader not installed or not available in CRA's webpack config.","error":"Module not found: Can't resolve 'babel-loader'"},{"fix":"Ensure plugin is wrapped in { plugin: ..., options: { includes: [...], excludes: [...] } }.","cause":"Incorrect options shape in craco config.","error":"Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}