Some kind of Duplicate Declaration error

It’s probably something really obvious, but I can’t see it.
I’ve made a bunch of fairly standalone changes, some functions, scenarios and tests for some new functionality that I have not wired into my app yet.
As of today when I run yarn rw g types I get an error that looks a bit like this:

/Users/pathtoapp/node_modules/@babel/traverse/lib/scope/index.js:399
      throw this.hub.buildError(id, `Duplicate declaration "${name}"`, TypeError);
                     ^

TypeError: Cannot read properties of undefined (reading 'buildError')`

I can’t recall the last time that yarn rw g types worked, but it can’t have been that long ago, probably a day or two.

Even checking out older versions of my code from a couple of weeks back still gets this error.
I’m assuming that I have either declared more than one export with the same name, or perhaps imported something with the same name as a locally scoped value. But I can’t work out how to find out.
Anyone else come across this and have a suggestion?
Thanks

I did eventually figure that out after a nights sleep.
I had duplicate import in a file on the web side which was trying to import the same thing from two different locations.
I found it by digging in the nodemodules folder to find the location in the file above:
pathtoapp/node_modules/@babel/traverse/lib/scope/index.js
and at the line number indicated: 399
I added a log statement into the if duplicate block that logged out the name of the duplicated import.

There might be a better way but it worked for me

2 Likes

Awesome! Glad you got it figured out! :raised_hands: