-
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
"Duplicate declaration" error when running "lingui extract" with NODE_ENV=production #433
Comments
Hey @agwells, In the meantime: You don't have to run |
Thanks for the confirmation about It was just due to the sequence of steps in our build pipeline, that we were running |
Ah, cool! I'm glad you figured out a workaround. I'll keep it open just in case I find a root cause. |
I just started seeing this same issue because we run |
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. |
@tricoder42 Just in case it got forgotten somehow, or maybe i'm doing something wrong.
|
This issue probably will be fixed next Tuesday, meanwhile you can pass NODE_ENV=development before lingui extract command. @namirsab |
Released 3.5.0 with this fix |
I updated to |
Updated to 3.10.2, and still seeing this issue. |
Still seeing this issue, even with NODE_ENV=production: Invocation:
|
me too at latest lingui
Exactly the same for me. |
Any particular update on this one? not even sure why this ticket was closed. Dependencies:
Any updates on this? EDIT: Confirmed that adding the |
I go insane but this error still lives on. Isn't this the only outstanding purpose of this library??? |
@maxfetz
This is incorrect, on production pipelines the command I know this sucks somehow but we have life and we always try our best :) We'll try to look at this as soon as possible. Merry Xmas to everyone. |
Sorry for my little rant. I was very frustrated. My project looks similar to this one: @ivandotv/nextjs-translation-demo To reproduce the problem
Now this only works under Linux and yarn. With npm and/or Window (and yarn) you need to set the environment variable with cross-env. (Maybe somebody knows why?) But in all circumstances, it only works with NODE_ENV=development. |
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. |
no, not really stale... |
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. |
Hello, this is happening to me even while I set NODE_ENV=development. Any clue why? I'm on latest version. |
I also had this Problem after updating all my packages. NODE_ENV=development didn't fix it. I found that the problem was the browserlists config. When I use "last 2 versions, not IE 11, not dead, > 2%" instead of only "last 2 versions" the error is fixed. I hope this helps someone else. |
I was intrigued by @motionVector's comment since I also noticed a change in the number of errors reported after updating the caniuse-lite db. I was able to narrow it down to whether the Android 4.4.3 browser should be supported by babel or not. So in our case, "browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all",
"not android 4.4.3"
] (Of course, setting the 0.2% cutoff to a higher value would also work because it then excludes the old stock android browsers, too) It looks like babel applies some transforms to the source code ( Without Update: I was able to figure out what "feature" triggered babel to interfere with the lingui macro: It was affecting files where we would do a destructuring assignment at the module level: const { Foo } = { Foo: 42 } |
@iStefo Yep, removing destructuring at top level fixes the issue for me 🚀 |
Describe the bug
I've recently upgraded my LinguiJS package versions from 2.7.0 to 2.7.2. Since the upgrade, my build step to extract language strings crashes with an error message about a duplicate declaration of
Trans
. After some experimentation, I discovered that this only happens when theNODE_ENV
environment variable isproduction
. If I setNODE_ENV
todevelopment
ortest
, it works fine.(I haven't had time yet to try to replicate this error on a newly set-up project, so it's possible it may be related to other quirks in my project.)
To Reproduce
{Trans}
like so:package.json
like so:npm run extract
TypeError: /path/to/project/src/file.js: Duplicate declaration "Trans"
Expected behavior
lingui extract
should complete successfully, with output like this:Additional context
As mentioned above, this error only happens when running lingui with
NODE_ENV=production
. When I run it withNODE_ENV=development
, it finishes successfully. That will probably be my workaround for the time being, because I imagine the NODE_ENV probably shouldn't have any effect on the CLI scripts anyhow.Here's the full error stack from npm (with some file names changed):
2.7.2
The text was updated successfully, but these errors were encountered: