V5 & Monorepo: Error: Trans component was rendered without I18nProvider #2091
Replies: 1 comment
-
The doing dependency right in the monorepo is a complicated topic. It's not related to lingui, but to the monorepos itself. The main rule is, if you import something in the package, you should have this stated in the dependency. If all of your code lies in the Regarding your issue, first you need to check that you don't have few versions of Next, because I don't know how your monorepo works, it might be the case that you bundle your The same could be with a React package, make sure it with a Also pay attention to the |
Beta Was this translation helpful? Give feedback.
-
Hey, I will try to provide a monorepo but for the moment, I'll just hope someone has an idea:
I started from the lingui
next
branch with thenextjs-swc
example.In the context of a monorepo, have a nextjs project in
apps/web
. Inside of it, I have this as a dependency:"@lingui/react": "5.0.0-next.4",
I also have a shared codebase in
packages/app
, inside of it I have basically all of my code, nextjs only loads the screens frompackages/app
.In order for my
<Trans />
calls to work, I had to declare"@lingui/react": "5.0.0-next.4",
as a dependency as well.The issue is, when you declare twice
"@lingui/react": "5.0.0-next.4",
in a monorepo you end up with this error:It honestly took me hours to troubleshoot this one.
For the moment I have the
@lingui/react
package declared in my root package.json. It's not a proper fix though.Beta Was this translation helpful? Give feedback.
All reactions