fix(nuxt): follow Nuxt module conventions for server-side imports#8439
fix(nuxt): follow Nuxt module conventions for server-side imports#8439wobsoriano wants to merge 9 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
🦋 Changeset detectedLatest commit: 11757e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a Nuxt Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 👉 Get your free trial and get 200 agent minutes per Slack user (a $50 value). Comment |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Fixes #8430 Imports h3 server runtime symbols from '#imports' (the Nuxt virtual module) instead of directly from 'h3', matching the convention used by the official Nuxt module builder. This removes a conflict with Nitro's unimport auto-import injection, which generated a virtual auto-imports module referencing H3Error, H3Event, etc. without emitting their import statements when @clerk/nuxt server files were present in the bundle. A local type stub (src/runtime/types/nitro-server.d.ts) re-exports the h3 symbols from their real package and is wired up via a paths["#imports"] alias in tsconfig.json, preserving full type safety during module development without switching from tsup. The stub is not included in the published dist. Since no @clerk/nuxt server file has a direct runtime import from 'h3' anymore, h3 is moved from dependencies to devDependencies. Nuxt apps already have h3 as a transitive dependency, so this is non-breaking.
|
!snapshot |
|
Hey @wobsoriano - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/astro@3.1.1-snapshot.v20260501171802 --save-exact
npm i @clerk/backend@3.4.5-snapshot.v20260501171802 --save-exact
npm i @clerk/chrome-extension@3.1.22-snapshot.v20260501171802 --save-exact
npm i @clerk/clerk-js@6.8.1-snapshot.v20260501171802 --save-exact
npm i @clerk/dev-cli@0.1.1-snapshot.v20260501171802 --save-exact
npm i @clerk/expo@3.2.8-snapshot.v20260501171802 --save-exact
npm i @clerk/expo-passkeys@1.0.21-snapshot.v20260501171802 --save-exact
npm i @clerk/express@2.1.13-snapshot.v20260501171802 --save-exact
npm i @clerk/fastify@3.1.23-snapshot.v20260501171802 --save-exact
npm i @clerk/hono@0.1.23-snapshot.v20260501171802 --save-exact
npm i @clerk/localizations@4.5.9-snapshot.v20260501171802 --save-exact
npm i @clerk/msw@0.0.21-snapshot.v20260501171802 --save-exact
npm i @clerk/nextjs@7.3.1-snapshot.v20260501171802 --save-exact
npm i @clerk/nuxt@2.3.1-snapshot.v20260501171802 --save-exact
npm i @clerk/react@6.5.1-snapshot.v20260501171802 --save-exact
npm i @clerk/react-router@3.2.1-snapshot.v20260501171802 --save-exact
npm i @clerk/shared@4.9.1-snapshot.v20260501171802 --save-exact
npm i @clerk/tanstack-react-start@1.2.1-snapshot.v20260501171802 --save-exact
npm i @clerk/testing@2.0.25-snapshot.v20260501171802 --save-exact
npm i @clerk/ui@1.7.1-snapshot.v20260501171802 --save-exact
npm i @clerk/upgrade@2.0.3-snapshot.v20260501171802 --save-exact
npm i @clerk/vue@2.1.1-snapshot.v20260501171802 --save-exact |
| "@nuxt/schema": "^4.1.3" | ||
| }, | ||
| "devDependencies": { | ||
| "h3": "^1.15.4", |
There was a problem hiding this comment.
Codex flagged h3 type imports that still need to come from direct dependencies. Might want to double check this
This package still exposes public declarations that import H3Event/EventHandler from h3 through @clerk/nuxt/server, @clerk/nuxt/webhooks, and helpers like createRouteMatcher. Moving h3 to devDependencies means strict package-manager installs can leave consumers unable to resolve those published declarations from @clerk/nuxt, even if Nuxt has h3 somewhere transitively. The runtime imports can come from #imports, but the package still needs to declare h3 as a dependency or peer dependency for its public type surface.
Description
All h3 server runtime symbols (
createError,eventHandler,setResponseHeader, etc.) are now imported from'#imports'instead of directly from'h3'. This matches the convention used by the official Nuxt module builder. Nuxt server files are expected to consume auto-import symbols through'#imports', which Nuxt/Nitro resolves at app build time.useRuntimeConfigwas already imported this way. This change extends the same pattern to all remaining h3 value imports acrossclerkMiddleware.ts,utils.ts,routeMatcher.ts, andwebhooks.ts.Since
h3is no longer a direct runtime import, it has been moved fromdependenciestodevDependencies. Any Nuxt app already hash3transitively via Nuxt itself, so this is non-breaking.Type safety
To keep
import { ... } from '#imports'fully typed during module development (without switching fromtsup), a local declaration stub atsrc/runtime/types/nitro-server.d.tsre-exports the relevant h3 symbols and is mapped viapaths["#imports"]intsconfig.json.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change