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

Cannot import from nitropack/runtime #2305

Closed
MickL opened this issue Mar 24, 2024 · 3 comments · Fixed by #2314
Closed

Cannot import from nitropack/runtime #2305

MickL opened this issue Mar 24, 2024 · 3 comments · Fixed by #2314

Comments

@MickL
Copy link
Contributor

MickL commented Mar 24, 2024

Reproduction (@pi0): https://stackblitz.com/edit/unjs-nitro-starter-w9u6yx?file=server%2Froutes%2Findex.ts,nitro.config.ts&title=Nitro%20Starter

Describe the bug

I am trying to figure out how to use Nitro without auto imports. I know defineEventHandler is imported from h3 but I cant find any module exporting defineCachedEventHandler, nitropack is not exporting it:

Bildschirmfoto 2024-03-24 um 16 42 53
@markthree
Copy link
Contributor

@MickL You can use the following import method ↓

import { defineCachedEventHandler } from "#imports"

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 25, 2024
@MickL
Copy link
Contributor Author

MickL commented Mar 25, 2024

Isnt this the exact same as using auto imports? The import comes from a file that needs to be pregenerated and obscures the real origin of the function?

I was hoping to get rid of this :/

Bildschirmfoto 2024-03-25 um 11 41 21

@pi0 pi0 changed the title No export for defineCachedEventHandler to import from Cannot import from nitropack/runtime Mar 25, 2024
@pi0 pi0 reopened this Mar 25, 2024
@pi0
Copy link
Member

pi0 commented Mar 25, 2024

You are right. While (current) recommendation is using #imports, if imports: false is used, there is no way of using direct import for nitropack/runtime which is actually the implementation.

(also updated your issue report with a reproduction please consider doing it in next issues 🙏🏼 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants