Repository navigation
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, |
|
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>
)
} |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
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-swcper 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
dynamicActivatenow looks like this:My
lingui.config.tsisFor the
@vitejs/plugin-reactmethodvite.config.ts:Even though it says it isn't used I also tried
.babelrc:{ "plugins": [ ["macros"], ] }I also tried this in
vite.config.ts:For the
@vitejs/plugin-react-swcmethodvite.config.ts:.swcrc:{ "$schema": "https://json.schemastore.org/swcrc", "jsc": { "experimental": { "plugins": [ [ "@lingui/swc-plugin", { }, ], ], }, }, }Do you see any problems, or have any advice how to track this problem down?
tia,
charles
All reactions