question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

"Duplicate declaration" error due to identifier traversal change

See original GitHub issue

Hey 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:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
ben-rogersoncommented, Dec 7, 2020

Thanks so much for your fast response and epic digging Conrad šŸ‘

1reaction
conartist6commented, Dec 7, 2020

As usual with babel the documentation consists of tweets: https://twitter.com/sebmck/status/1132038207309172736

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found