Skip to content

Commit 36513df

Browse files
authored
docs: Add note about react compiler (#2272)
1 parent d5c2086 commit 36513df

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

website/docs/installation.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Follow these steps to set up Lingui with Babel:
5656
When using a preset, first check if it includes the `macros` plugin. If so, then you don't need to install and set up `@lingui/babel-plugin-lingui-macro`. For example, `react-scripts` already includes the `macros` plugin.
5757
:::
5858

59+
:::caution
60+
If you're using [React Compiler](https://react.dev/learn/react-compiler), make sure that `@lingui/babel-plugin-lingui-macro` comes **before** the React Compiler plugin in the Babel plugins list. This ensures macros are expanded correctly before the compiler processes the code.
61+
:::
62+
5963
</TabItem>
6064
<TabItem value="swc" label="SWC">
6165

@@ -77,6 +81,12 @@ Follow these steps to set up Lingui with SWC:
7781
SWC Plugin support is still experimental. Semver backwards compatibility between different `@swc/core` versions is not guaranteed. See the [SWC compatibility](/ref/swc-plugin#swc-compatibility) for more information.
7882
:::
7983

84+
:::caution
85+
If you're using [React Compiler](https://react.dev/learn/react-compiler) with SWC, the `@lingui/swc-plugin` must run **before** the React Compiler plugin. This is necessary because Lingui macros need to be expanded before the React Compiler processes your code.
86+
87+
However, in Next.js, the React Compiler is enabled via a simple boolean flag (`reactCompiler: true`) in `next.config.js`, and there's currently no way to control plugin ordering. As a result, Lingui may not work correctly with the React Compiler in SWC-based setups like Next.js.
88+
:::
89+
8090
</TabItem>
8191
</Tabs>
8292

0 commit comments

Comments
 (0)