Skip to main content

SWC

Ladle uses @vitejs/plugin-react by default. This plugin uses Babel to transform all React code.

If you want to use SWC instead of Babel, you can do it by installing and adding @vitejs/plugin-react-swc into ./vite.config.js:

vite.config.js
import react from "@vitejs/plugin-react-swc";

export default {
plugins: [react()],
};

Ladle automatically disables the Babel plugin.

SWC is up to 20x faster than Babel and can supercharge your development experience. The only downside is that you can't utilize a rich ecosystem of Babel plugins if your project uses a special syntax.

Warning: @vitejs/plugin-react-swc@3.2.0 currently doesn't work with mdx files. Use 3.1.0 for now.