Where Does SWC Store Its Plugin Cache?
SWC caches compiled transform plugins in a .swc folder in your project. Default spot, the cacheRoot override and monorepo notes.
Last updated
SWC's filesystem cache holds compiled transform-plugin bytecode so repeat builds skip recompiling plugins. By default it appears as a .swc folder in the current working directory, with per-OS-arch subfolders underneath. Seeing it pop up in every monorepo package surprises people, but each package resolves its own working directory.
Point jsc.experimental.cacheRoot elsewhere (node_modules/.cache/swc is the popular convention) to gather the sprawl. Relative paths resolve per package, so monorepos can't easily force one shared root through config alone. Deleting .swc folders only costs rebuild time on the next run.
Where SWC stores this, by platform
.swc
In the working directory of the SWC invocation. Redirect with jsc.experimental.cacheRoot in .swcrc. Subfolders encode OS, arch and plugin-runner version.
.swc
Same project-relative default. Next.js sets its own cache dir explicitly, so framework projects may never show this folder at all.
.swc
Mirrors macOS. Gitignore it everywhere it can appear. Shared CI caches gain little here since entries key off the local toolchain.
Frequently asked questions
What is the .swc folder in my project?
SWC's cache of compiled transform plugins, keyed by OS, architecture and runner version. It regenerates automatically. Move it with the cacheRoot option or delete it when builds behave oddly.
How do I share one SWC cache across a monorepo?
Set the same absolute cacheRoot in every package's config, since relative values resolve per package. In practice most teams just gitignore each .swc and let them rebuild; the cost is small next to dependency installs.
Notice an outdated path? Let us know.