Replies: 2 comments 1 reply
-
Are there any examples of a working vite+react+typescript+lingui app using I made a simple/stripped down example using a clean vite based react project and the instructions from It does not work using Using Would anyone be kind enough to take a look at this project and see if they can tell why this is happening, as well as perhaps why the https://github.com/cgalpin/test-vite-lingui thanks, |
Beta Was this translation helpful? Give feedback.
-
Working vite-project-react-babel example Regarding const Numbers = () => {
const numbers = [
t`one`,
t`two`,
t`three`
]
return (
<ol>
{ numbers.map(number => <li key={number}>{number}</li>) }
</ol>
)
} Whenever you use + import { useLingui } from "@lingui/react";
const Numbers = () => {
+ useLingui()
const numbers = [
t`one`,
t`two`,
t`three`
]
return (
<ol>
{ numbers.map(number => <li key={number}>{number}</li>) }
</ol>
)
} |
Beta Was this translation helpful? Give feedback.
-
I have a Create React App that I am converting to Vite, which worked perfectly before the switch using
npx nx@latest init
. After switching the project to Vite I noticed only the ids for JS macros (liket
) display when deployed, and only then noticed that in dev the translations for the JS macros are not displaying either when I change languages.The problems I am experiencing are similar to discussion /discussions/1518 but made a different discussion since there are differences, and I am still stuck.
I have tried both using
@vitejs/plugin-react
/babel and@vitejs/plugin-react-swc
per https://lingui.dev/tutorials/setup-vite but neither way works. I am of course running extract and compile, and all worked before the switch.Before, with the CRA app, I did not use any extension on the import, but this is not allowed with Vite
My
dynamicActivate
now looks like this:My
lingui.config.ts
isFor the
@vitejs/plugin-react
methodvite.config.ts
:Even though it says it isn't used I also tried
.babelrc
:I also tried this in
vite.config.ts
:For the
@vitejs/plugin-react-swc
methodvite.config.ts
:.swcrc
:Do you see any problems, or have any advice how to track this problem down?
tia,
charles
Beta Was this translation helpful? Give feedback.
All reactions