React Compiler with plugin-swc
Will there be instructions on how to use the new React Compiler given that it's babel based?
For now the simplest way is to switch back to the Babel plugin. They working a Rust port, I hope this can be builtin in SWC in the future!
how can I New React Compiler setting Vite project, now? I try to rewrite "vite.config.ts" file (plus plugins section) ..... but the "babel" letter makes errors
You should use vite-plugin-react
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
const ReactCompilerConfig = {};
export default defineConfig({
plugins: [
react({
babel: {
plugins: [["babel-plugin-react-compiler", ReactCompilerConfig]],
},
}),
],
});
Will be there an option to use react compiler with SWC in the future?
If the React team lands the Rust port of the compiler, I think SWC will try to integrate it directly. But the rust part didn't get updated since annouced: https://github.com/facebook/react/commits/main/compiler/crates
The Rust port has been removed: https://github.com/facebook/react/pull/32219
For React Compiler though, we plan to continue using JavaScript and explore lightweight native wrappers for things like OXC and SWC plugins.
Yeah, they still plan to have some integrations, but it will probably take times too
See also https://github.com/oxc-project/oxc/issues/10048
Any update on this please?