fix: import functions from h3
with relative path
#2207
Closed
+6
β7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Linked issue
β Type of change
π Description
When I use nuxt with pnpm without shamefully-host, I noticed that I can't import functions like
defineEventHandler
from#imports
. When I inspected the generated types in thenitro-imports.d.ts
I found why this is. The import in this file is not relative into the node modules store. It is a named re-export likeexport { defineEventHandler, ... } from 'h3'
. This re-export will not work because of the not hoistedh3
package. Every other export/import in this file already used a relative import, so i figured this might be a problem.With this change, the already existing import resolution map is used to resolve the named import to a relative path. If this named import was by design, I'm interested why, but feel free to just close this PR.
π Checklist
I also provide a patch for applying the same to nitropack with pnpm patch
PNPM patch to test it with nuxt example project