Cannot process file /<path>.tsx: Duplicate declaration "Trans"
See original GitHub issueDescribe the bug
When running lingui extract
I get the error Duplicate declaration "Trans"
(“t” seems to be OK).
To Reproduce
Cannot process file /<path>.tsx: Duplicate declaration "Trans"
15 | // i18n
16 | import { useI18N, Locale } from 'i18n';
> 17 | import { t, Trans } from '@lingui/macro';
Expected behavior
No error on lingui extract
Additional context
- Tried v3.4.0 and still had issues
- CLI version v3.2.1 repros the issue
- CLI version v3.1.0 does not repro the issue
- @babel/core@7.12.10
- Using Lingui in a NextJS project
- Looked at the diff (https://github.com/lingui/js-lingui/compare/v3.1.0...v3.2.1) and there are two changes that jump out, but I don’t understand the code enough to troubleshoot part this point. (https://github.com/lingui/js-lingui/pull/846 and https://github.com/lingui/js-lingui/pull/854) (cc @semoal and @Bertg in case they have any ideas)
- .babelrc
{
"presets": ["next/babel"],
"plugins": ["macros"],
"env": {
"test": {
"plugins": ["dynamic-import-node"]
}
}
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:35 (13 by maintainers)
Top Results From Across the Web
Cannot process file /<path>.tsx: Duplicate declaration "Trans"
When running lingui extract I get the error Duplicate declaration "Trans" ("t" seems to be OK). To Reproduce
Read more >Confusing "duplicate identifier" Typescript error message
If no "files" property is present in a tsconfig.json, the compiler defaults to including all files in the containing directory and subdirectories.
Read more >babel/plugin-transform-typescript
This plugin adds support for the types syntax used by the TypeScript programming language. However, this plugin does not add the ability to...
Read more >TypeScript rules for Bazel - GitHub Pages
(Note, if you use Project References this is not the case, TS will know the referenced file is part of the other program.)...
Read more >rollup.js
mjs import { readFileSync } from 'node:fs'; // Use import.meta.url to make the path relative to the current source file instead of process.cwd()...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks guys, changing
"extract": "lingui extract"
to"extract": "NODE_ENV=development lingui extract"
fixed it on my fresh install with NextJS. If I understood correctly what is said here I can keep it like that and not worry about it because it doesn’t need to haveNODE_ENV=production
when building for prod?The error is still there.
Duplicate
declaration “Trans”