"Duplicate declaration" error due to identifier traversal change
See original GitHub issueHey Kent š
Iām experiencing an import issue in twin.macro thatās popped up in the latest version of babel-plugin-macros (v3.0.0).
Iāve tracked down the change thatās caused the break and noticed it wasnāt described in the change list:
- state.file.scope.path.traverse({
+ traverse(state.file.ast, {
Identifier() {},
})
It breaks with the following error:
./pages/index.tsx
TypeError: /Users/.../pages/index.tsx: Duplicate declaration "_styled" (This is an error on an internal node. Probably an internal error.)
The error hints at something else due to twin having inserted another styled-components/macro
import. (A macro adding another macro ha!)
Hereās the code that inserts the import in twin.macro:
twinImportPath.insertBefore(
t.importDeclaration(
[t.importDefaultSpecifier(generateUid('cssPropImport', program))],
t.stringLiteral(styledComponentsMacroImport)
)
)
Reference issue: https://github.com/ben-rogerson/twin.macro/issues/241
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Duplicate declaration in current scope | Microsoft Learn
In this article. Check the current procedure, module, or project and remove any duplicate declarations. A Const statement uses the same name asĀ ......
Read more >Chapter 7: Arrays - cs.utsa.edu
Objectives. Declare, Initialize, and Use Arrays; Use Loops for Array Traversal; Pass Arrays as Parameters; Return Arrays from Methods; Understand ReferenceĀ ...
Read more >NG0300: Multiple components match with the same tagname
Use the element name from the error message to search for places where you're using the same selector declaration in your codebase: content_copy...
Read more >āClangā CFE Internals Manual ā Clang 16.0.0git documentation
Diagnostics are the warnings and errors produced when the code is incorrect or dubious. In Clang, each diagnostic produced has (at the minimum)...
Read more >COMP3131/9102 Assignment 4
As before, if no lexical, syntactic or semantic error is found, your compiler should ... To detect duplicate declarations using the same identifier,Ā ......
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 so much for your fast response and epic digging Conrad š
As usual with babel the documentation consists of tweets: https://twitter.com/sebmck/status/1132038207309172736