Repository navigation
React macros are broken when using the OXC-based React Compiler #2657
|
Recently, Vite's React plugin added support for an OXC-based port of the React Compiler, not relying on a Babel pass. For reference:
This yields massive performance improvements when enabled (I have seen some build times reduced by half). But when using Lingui, it seems the React macros,
I have setup a reproduction here: AFCMS/vite-lingui-test#1 (master branch is with Babel compiler) I am unsure where the issue comes from. |
Answered by
timofei-iatsenko
Sep 2, 2026
Replies: 1 comment 1 reply
|
@AFCMS change the order of babel plugin with react plugin: import { lingui, linguiTransformerBabelPreset } from "@lingui/vite-plugin";
import babel from "@rolldown/plugin-babel";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
babel({ presets: [linguiTransformerBabelPreset()] }), // <-- should be before React plugin, to be able to transform Trans tags before react compiler transform them
react({ compiler: true }),
lingui(),
],
});I tested it on your example and it works. |
1 reply
Answer selected by
timofei-iatsenko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@AFCMS change the order of babel plugin with react plugin:
I tested it on your example and it works.