Skip to content
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

bug: import functions from h3 with relative path, breaks with pnpm and no shamefully hoist #2249

Closed
Louis9902 opened this issue Mar 12, 2024 · 3 comments

Comments

@Louis9902
Copy link

Environment

tried with 3.10.3(vite@5.1.6)

Reproduction

https://stackblitz.com/edit/github-bshclz?file=.nuxt%2Ftypes%2Fnitro-imports.d.ts%3AL128

Describe the bug

Some declarations use just 'named' imports, which cause resolution problems when the project is restored with pnpm and no shamefully-hoist as the dependencies are not really present in the node_modules.

This includes files like nitro-imports.d.ts (h3) nitro-nuxt.d.ts (nuxt/schema, h3, ...) nitro-config.d.ts (defu) nitro-routes.d.ts (nitropack)

Additional context

I partially tried to fix this in PR 2207, but noticed since then that there are a lot more of occurrences. I find this strange because of nuxt/nuxt 14146.
With this problem, I can not create server handler with defineEventHandler without type problems.

Logs

No response

@danielroe
Copy link
Member

This issue should be resolved in the latest version of Nuxt with nuxt/nuxt#26085.

@danielroe
Copy link
Member

danielroe commented Mar 15, 2024

Nitro usage alone is fine - the issue IIRC is that Nuxt is using nitropack types, but TS can't find nitropack.

@pi0
Copy link
Member

pi0 commented Mar 15, 2024

thanks for confirming. then let's track for nuxt.


btw related discussion for nitro itself (direct import types don't work today with hosting): #2232

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants