-
Notifications
You must be signed in to change notification settings - Fork 31
Nuxt module issue when running prepack(nuxt-module-build) when exposing a composable that calls useFetch #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The issue here is that you have different versions of ofetch installed in your app, and is emitted as part of the build process. Check your lockfile and try deduping it. |
Hey @danielroe, I only have one version of ofetch.
|
Hm. This might be about the difficulty with emitting declarations that depend on complex inferred types of the kind we have for useFetch. |
We're currently running into the same issue, when building a wrapper composable around useFetch. When we import this into another composable we receive te same error. If someone has a workaround for the time being that would be great. Or maybe point us in the right direction how to solve the issue, so we can contribute. |
Our workaround was to add
{
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"types": ["ofetch"]
}
} |
I am running into this issue when upgrading from Nuxt When I add a return type of I tried @markglattback suggestion with no success. Any other ideas to get past this error? |
@MaxWeisen
|
Hey @trc-mathieu I tried the method you used and it does not work. The return type of This continues to make to wonder why this worked on Nuxt |
hum, that's odd. I'm also using nuxt 3.10.1. I could try if you have a small reproduction with your types. |
@trc-mathieu I will work on a reproduction. In the meantime, here is the error:
|
Ran into this issue after upgrading from nuxt 3.9.3 to 3.10.3. |
@dvdmlln I'm not too sure why but I can't seem to be able to run prepack on your repo. I always get this error
|
Did you run |
My bad. To make it work you need to type the return of
|
Also having this issue on |
Let's track in #141 |
Discussed in nuxt/nuxt#22328
Originally posted by trc-mathieu July 25, 2023
I get a typescript error after running
pnpm prepack
. Here is a reproduction repoSimply run
pnpm i
and thenpnpm prepack
.Context
I have one endpoint at
/api/applications
that returns a list of string.I have one composable
useApplication
the simply does this for now:When running
pnpm prepack
, I get this error:Do I have to explicitly set the return type of the function that is using
useFetch
? I feel that this is not convenient and I wonder if I am not doing something wrong or if it's missing something on nuxt side or an issue withnuxt-module-build
.I also saw that
ofetch
is no transpiled by default so I tried transpiling it but no success.Any help would be appreciated!
ps. I also noticed that if I run
pnpm dev:build
and thenpnpm prepack
, the error is not present anymore but theuseApplication
return type is typed asany
The text was updated successfully, but these errors were encountered: