Webpack loader that transpiles JavaScript/TypeScript files using Babel. Current stable version is 10.1.1, with a release cadence of minor/patch updates every few months. It integrates Babel's transformation pipeline into webpack's build process, supporting features like caching, customizing cache identifiers, and passing source maps. Key differentiators: it is the official Babel team supported loader, tightly integrated with webpack's module system, and supports both webpack and Rspack. It requires @babel/core as a peer dependency and works with Babel 7 or 8 beta. Compared to alternatives like esbuild-loader or swc-loader, babel-loader offers full Babel plugin ecosystem compatibility and extensive customization options for legacy browser support.
npm install babel-loaderVerified import paths — ran on the pinned version, not inferred.
Basic webpack configuration using babel-loader to transpile JavaScript files with @babel/preset-env and @babel/plugin-transform-runtime.
Upgrade Node.js to ^18.20.0 || ^20.10.0 || >=22.0.0 and webpack to >=5.61.0
If you relied on custom cache hash, ensure webpack's output.hashFunction is configured correctly
Stop passing 'caller'; it is no longer validated
Upgrade to 9.1.0+ to pass external dependencies
Upgrade to 9.1.2 or later
If you rely on no logging, use webpack's infrastructure logging configuration
npm install --save-dev @babel/core
Add @babel/preset-react to the presets option
Update @babel/core to ^7.12.0 or higher
Update webpack to >=5.61.0