Orval fails to find my custom instance mutator when there's await import
inside of it
#1634
Labels
bug
Something isn't working
await import
inside of it
#1634
What happens
Orval fails to find my custom instance mutator function when there's
await import
inside any of the mutator function dependency imported packages.What are the steps to reproduce this issue?
await import
in it.Example
Here's my
orval.config.ts
:Here's
src/utils/http/custom-instance.ts
:As you can see there's a named export called
customInstance
, but if I runorval
in the CLI, it fails to find it and gives me the following error:So, I kept tracking what's breaking it and found out that this line is the culprit:
after commenting this line,
orval
generates just fine and finds thecustomInstance
just fine.So, I kept digging.
Here's my
src/utils/http/base-http-instance.ts
:Again, in this file everything was fine except for this import:
So, I checked it and here's my
src/utils/http/http-instance.ts
(the file is big so I truncated it and only showed the culprit part):Now as you can see I use different packages to extract the cookies data, while on the server side I use the
next/headers
, and on the client side I usejs-cookie
. This is done by this dynamic import.When I commented these two
await import
lines everything worked just fine.What happens?
Orval fails to generate anything because it fails to find the mutator custom instance function exported.
What were you expecting to happen?
Orval to succeed in generating everything just fine because Orval doesn't run the code and doesn't check if it works, so why is the
await import
in a dependency module breaking Orval's ability of detecting the exported function from the custom mutator instance?Any logs, error output, etc?
What versions are you using?
The text was updated successfully, but these errors were encountered: