Lesson 25 / 31
Migrating from Babel to SWC
Migrate from Babel to SWC step by step: audit plugins, swap packages, convert config and verify the build.
Assessment: is your project ready?
Check if your Babel plugins are available in SWC. If you use only common transforms (JSX, TypeScript, class properties), migration is straightforward. If you use exotic plugins, stay with Babel.
Step 1: Uninstall Babel, install SWC
Remove Babel packages and add SWC. Test that the build still works.
npm uninstall @babel/core @babel/cli @babel/preset-env @babel/preset-react
npm install --save-dev @swc/core @swc/cliStep 2: Replace .babelrc with .swcrc
Convert your Babel config to SWC format. Most settings map directly.
# Keep .babelrc for reference, create .swcrc
cp .babelrc .babelrc.backup
# Edit new .swcrc with equivalent SWC settings