-
Notifications
You must be signed in to change notification settings - Fork 397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot process file /<path>.tsx: Duplicate declaration "Trans" #952
Comments
Hi Eric! Thanks for using Lingui |
I was using |
#433 We have here a similar issue here, let me create a sample repo (or if you could provide us a sample repo for reproducing the issue, I could check in detail tomorrow) :) |
https://codesandbox.io/s/nextjs-lingui-djzqm?file=/pages/index.tsx Here is a codesandbox that you could modify with your changes :) |
I just set the NODE_ENV=test and it seems to work. I was not setting NODE_ENV=production, but I guess that would be the default? |
Probably in some process is setting up NODE_ENV=production, or the ci.. Dunno Anyways I'll take a look to our internal babel generator if we can force this to be in NODE_ENV=development for example.. |
Sounds good. For some more info... I used
|
Thanks guys, changing |
Exactly, basically node_env=production applies changes to code that lingui can't interpret |
I think i got a fix for this "issue", babel transform api allows to overwrite NODE_ENV variable internally, so probably won't be required to use nODE_ENV=development before lingui extract command. @ericvera next tuesday we'll release a new version with this change introduced if you can tell us if this fixes the issue, would be amazing =) |
Happy to.
…On Wed, Jan 27, 2021 at 9:49 AM Sergio Moreno ***@***.***> wrote:
I think i got a fix for this "issue", babel transform api allows to
overwrite NODE_ENV variable internally, so probably won't be required to
use nODE_ENV=development before lingui extract command.
@ericvera <https://github.com/ericvera> next tuesday we'll release a new
version with this change introduced if you can tell us if this fixes the
issue, would be amazing =)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#952 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUKOB3QL6EWUKJBIL64LKLS4AYW5ANCNFSM4WHYMYHA>
.
|
@ericvera Released 3.5.0 give it a try plz |
The error is still there. It still does not work without |
Alright i'll take a deeper look, tough that forcing babel to use development was enough, but looks that NODE_ENV always has precedence. If any of you has a reproduction repo where i can try will be super |
I'll try to debug it a little bit. Looks like the error happens somewhere after transformFileSync call. I have commented out that call and the error is still there. That's because I'm using ts and therefore typescript extractor is executed 😅 |
In my case the solution is to pass Here is babelrc from my project: {
"presets": [
[
"next/babel",
{
"preset-react": {
"runtime": "automatic",
"importSource": "@emotion/react"
}
}
]
],
"plugins": ["@emotion/babel-plugin", "macros"]
} The conflicting part is inside https://github.com/vercel/next.js/blob/canary/packages/next/build/babel/preset.ts If I don't know what Looks like my issue is not due to the bug inside lingui 😅. I'll continue to use |
Same as @SleepWalker. Also still seeing the issue with the latest version. |
After upgrading from v3.2.3 to v3.6.0 I encounter the same error. Forcing the NODE_ENV to development fix the issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Just wanted to let you know, I just switched to lingui and the fix was the node enviornment. |
The error is still there. |
I fixed the issue on my nextjs project on windows 10, windows 11!!!
Hopeful help! |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This is still a thing |
This is still happening to me in the latest version. I think this is not fixed |
This did the trick for me ! Thank you! |
I ran into this and the |
I ran into this again, |
I'm too using Next.js and I've been using the
I was using lingui 3.12.1 but I updated to the current latest 3.14.0. I noticed that without using
These fixed my errors one by one. |
Also using next.js. I tried downgrading all the way to 3.0 with no luck. I'm currently on 3.14.0. I also had to use the t macro function sadly. I'll keep digging to see if I can find the route of the issue. |
This |
Possible solution here? In the meantime the band aid solution still seems to use cross-env and set Not sure what exactly the fix for the library is but hopefully this can point someone in the right direction to fix this. I'm guessing this is impacting pretty much everyone trying to use this library right now. |
Looks like its still an issue. I reopen this and assign for myself. |
Fixed in #1367 would be released as part of v4 |
Describe the bug
When running
lingui extract
I get the errorDuplicate declaration "Trans"
("t" seems to be OK).To Reproduce
Expected behavior
No error on
lingui extract
Additional context
The text was updated successfully, but these errors were encountered: