Search code examples
javascriptreactjsgraphqlaws-amplifyaws-appsync

Function exported and imported, no errors, but getting '... is not exported from ...'


I've never seen this before.

I try to export a function and import it in another file. When I attempt an import, my autoimport tool finds it and imports it. Autocompletion is even there when I reference to it. There are no errors showing in code, but I get a console error when compiling that says the function is not exported...

Exported from queries...

enter image description here

The import statement

enter image description here

Note that I've also tried without success

import { getAllRoles } from '../graphql/queries'

Now where I actually use the imported function...

enter image description here

As you can see, no syntax / import error highlighted, and when I save and compile...

enter image description here

On top of all that, note that the queries file containing the exported function is auto-generated by Amplify codegen from an AppSync API, so I can't see why they'd mess it up.

I'm very confused. Any ideas?


Solution

  • I had two files with the same name in the same folder, one js and one ts. It tried to import the .js file for some reason.