diff --git a/apps/web/package.json b/apps/web/package.json index f79850b44..36edfa653 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -93,7 +93,6 @@ }, "devDependencies": { "@babel/core": "^7.29.7", - "@lingui/babel-plugin-lingui-macro": "^6.9.0", "@lingui/cli": "^6.9.0", "@lingui/format-po": "^6.9.0", "@lingui/vite-plugin": "^6.9.0", diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 2a6ca454c..0122ead83 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -2,7 +2,7 @@ import type { ProxyOptions } from "vite"; import { readFileSync } from "node:fs"; import { mkdir, readFile, rm, writeFile } from "node:fs/promises"; import { fileURLToPath, pathToFileURL } from "node:url"; -import { lingui, linguiTransformerBabelPreset } from "@lingui/vite-plugin"; +import { lingui } from "@lingui/vite-plugin"; import babel from "@rolldown/plugin-babel"; import tailwindcss from "@tailwindcss/vite"; import { devtools } from "@tanstack/devtools-vite"; @@ -55,6 +55,11 @@ async function prerenderPages() { } } +// TanStack Router loads `route.tsx?tsr-split=…`. The native parser infers syntax from the filename, +// and the query hides `.tsx`, so JSX is parsed as JS. +const linguiPlugin = () => + lingui({ macroTransform: { parser: { syntax: "typescript", tsx: true, decorators: true } } }); + const serverPaths = ["/api", "/mcp", "/uploads", "/.well-known", "/schema.json"] as const; const serverProxy = serverPaths.reduce( @@ -110,7 +115,7 @@ export default defineConfig({ // The PDF worker renders templates with translated section titles, so it needs the catalogs and macros too. worker: { format: "es", - plugins: () => [lingui(), babel({ presets: [linguiTransformerBabelPreset()] })], + plugins: () => [linguiPlugin()], }, server: { @@ -141,9 +146,9 @@ export default defineConfig({ autoCodeSplitting: true, }), viteReact(), - lingui(), + linguiPlugin(), // Keep @babel/core on 7: under Babel 8, React Compiler 1.0 skips every function with a destructuring default // (guarded by src/react-compiler.test.ts). - babel({ presets: [reactCompilerPreset(), linguiTransformerBabelPreset()] }), + babel({ presets: [reactCompilerPreset()] }), ], }); diff --git a/apps/web/vitest.config.ts b/apps/web/vitest.config.ts index 4aa3ccdec..f9e69bde7 100644 --- a/apps/web/vitest.config.ts +++ b/apps/web/vitest.config.ts @@ -1,6 +1,5 @@ import { fileURLToPath } from "node:url"; -import { lingui, linguiTransformerBabelPreset } from "@lingui/vite-plugin"; -import babel from "@rolldown/plugin-babel"; +import { lingui } from "@lingui/vite-plugin"; import tailwindcss from "@tailwindcss/vite"; // @boundaries-ignore root shared Vitest config import { createVitestProjectConfig } from "../../vitest.shared.mts"; @@ -8,5 +7,5 @@ import { createVitestProjectConfig } from "../../vitest.shared.mts"; export default createVitestProjectConfig({ name: "web", dirname: fileURLToPath(new URL(".", import.meta.url)), - plugins: [tailwindcss(), lingui(), babel({ presets: [linguiTransformerBabelPreset()] })], + plugins: [tailwindcss(), lingui({ macroTransform: true })], });