yak-swc is a Rust-based SWC (Speedy Web Compiler) plugin designed to compile CSS-in-JS code at build time, specifically for projects using `next-yak`. It transforms `next-yak`'s styled components syntax into optimized CSS, leveraging SWC's performance for faster build times. The current stable version is 9.4.1, with patch and minor releases aligning with the `next-yak` ecosystem, indicating an active development and release cadence. A key differentiator is its Rust implementation for high performance, allowing build-time CSS extraction, and its separation from the main `next-yak` package to ensure compatibility with specific `@swc/core` versions. This plugin is crucial for achieving zero-runtime CSS-in-JS with `next-yak` in environments leveraging SWC.
npm install yak-swcVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to configure `yak-swc` in a `.swcrc` file to process `next-yak` styled components within a TypeScript React project.
Always install `yak-swc` and `@swc/core` versions recommended by the `next-yak` documentation or ensure compatibility using their provided compatibility tables.
Remove `.babelrc` or `babel.config.js` files to ensure Next.js uses SWC as the default compiler. Consider migrating Babel-specific transforms to SWC equivalents.
Upgrade to `yak-swc@9.4.1` or newer to fix React Fast Refresh issues related to styled components by correctly renaming internal component functions.
Update to `yak-swc@9.4.0` or later to resolve false parsing errors for complex dynamic member expressions within styled components.
Upgrade to `yak-swc@9.4.1` to fix issues with Vite build processes hanging during multi-environment builds.
Check the `next-yak` documentation or compatibility tables for `yak-swc` and `@swc/core` to install matching versions. Typically, upgrading both to their latest compatible versions resolves this.
Update `yak-swc` to version 9.4.0 or newer to correctly handle dynamic member expressions during compilation.
Upgrade to `yak-swc@9.4.1` or later, which includes a fix for React Fast Refresh full page reloads by renaming the internal component function.