WindowsmacOSLinux

Where Does Babel Keep Its Cache?

babel-loader caches transforms in node_modules/.cache/babel-loader when cacheDirectory is on; Babel options live in babel.config.js.

Last updated

Babel proper keeps no project cache; the disk cache people trip over belongs to babel-loader. With cacheDirectory enabled, transformed files land in node_modules/.cache/babel-loader (or the OS temp dir when no node_modules is found upward).

Transform rules themselves live in babel.config.js (whole project) or .babelrc (file relative). The cache identifier folds those in, so editing them normally busts the cache without manual help.

Where Babel stores this, by platform

Windows
[ProjectDir]\node_modules\.cache\babel-loader

Loader transform cache, only when cacheDirectory is set. Enable it in webpack loader options for faster rebuilds; delete the folder when output smells stale.

macOS
[ProjectDir]/node_modules/.cache/babel-loader

Same cache path. Babel's own settings come from babel.config.js or .babelrc; BABEL_ENV and NODE_ENV select env specific blocks inside them.

Linux
[ProjectDir]/node_modules/.cache/babel-loader

Same layout. babel-node users get a separate JSON cache controlled by BABEL_CACHE_PATH instead of this folder.

Frequently asked questions

Webpack serves stale code after I changed Babel config. How do I clear it?

Delete node_modules/.cache/babel-loader and rebuild. The cache keys on config and versions, but restored files and clock skew can still serve stale transforms.

Can I enable the cache from .babelrc?

No. cacheDirectory belongs to babel-loader (the webpack integration), not Babel itself. Set it in the loader options; .babelrc and babel.config.js cannot carry it.

Notice an outdated path? Let us know.