I still ran into errors regarding h3 v2 types with Nuxt 4.5.2 on `pnpm i` (without shamefully-flatten) after rolling out some dependency updates. `nuxt typecheck` failed with:
@danielroe I still ran into errors regarding h3 v2 types with Nuxt 4.5.2 on pnpm i (without shamefully-flatten) after rolling out some dependency updates. nuxt typecheck failed with:
error TS2724: '"h3"' has no exported member named 'H3CorsOptions'. Did you mean 'CorsOptions'?
error TS2305: Module '"h3"' has no exported member 'ValidateFunction'..nuxt/tsconfig.server.json pointed h3 to v2:
"h3": ["../../../node_modules/.pnpm/[email protected]_…/node_modules/h3"]From what I can tell, this PR fixes the runtime side: Nitro's h3 alias is resolved from @nuxt/nitro-server, so the bundle gets v1. Looks like this doesn't fix the types side though?
My AI of choice says:
h3is inexcludedAlias, so that pinned path doesn't reach the tsconfig. Theh3entry there comes fromtypescript.hoistinstead, which is resolved frommodulesDirrather than from@nuxt/nitro-server. Under pnpm, that lookup seems to fall through tonode_modules/.pnpm/node_modules/h3, which in our case held v2 (pulled in viadevframe).
Adding h3 v1 as a direct dependency fixed it for me for now. Might be worth pinning the type path the same way as the runtime alias? Oh, and clanker says: "ofetch and crossws may have the same issue".
Hopefully useful info and no hallucinations or agent BS here
Originally posted by @Anoesj in https://github.com/nuxt/nuxt/pull/35774#issuecomment-5833384897
Source: nuxt/nuxt