Description
captureRouterTransitionStart is exported from the browser condition entry point (index.client.js), but is not included in the types condition entry point (index.types.d.ts).
This causes ESLint import/namespace rules (e.g., oxlint) to report:
"captureRouterTransitionStart" not found in imported namespace "@sentry/nextjs"
The function works correctly at runtime because the browser bundler resolves the browser condition. However, static analysis tools resolve the types condition and cannot find the export.
Steps to Reproduce
- Follow the official manual setup guide
- Add to
instrumentation-client.ts:
import * as Sentry from "@sentry/nextjs";
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;
- Run a linter with
import/namespace rule (e.g., oxlint, eslint-plugin-import)
Expected Behavior
No lint error — captureRouterTransitionStart should be found in the @sentry/nextjs namespace.
Actual Behavior
"captureRouterTransitionStart" not found in imported namespace "@sentry/nextjs"
Root Cause
In @sentry/nextjs/package.json exports:
| Condition |
Entry Point |
Has captureRouterTransitionStart? |
types |
index.types.d.ts |
❌ No |
browser |
index.client.js |
✅ Yes |
node |
index.server.js |
❌ No (expected) |
The types entry should include client-only exports so that static analysis tools can resolve them.
Verified in @sentry/nextjs@10.43.0:
build/types/client/index.d.ts exports captureRouterTransitionStart
build/types/index.types.d.ts does not re-export it
Environment
@sentry/nextjs: 10.43.0
- Linter: oxlint 1.51.0
- Next.js: 16.1.6
- Runtime: Bun 1.3.11
Description
captureRouterTransitionStartis exported from thebrowsercondition entry point (index.client.js), but is not included in thetypescondition entry point (index.types.d.ts).This causes ESLint
import/namespacerules (e.g., oxlint) to report:The function works correctly at runtime because the browser bundler resolves the
browsercondition. However, static analysis tools resolve thetypescondition and cannot find the export.Steps to Reproduce
instrumentation-client.ts:import/namespacerule (e.g., oxlint, eslint-plugin-import)Expected Behavior
No lint error —
captureRouterTransitionStartshould be found in the@sentry/nextjsnamespace.Actual Behavior
Root Cause
In
@sentry/nextjs/package.jsonexports:captureRouterTransitionStart?typesindex.types.d.tsbrowserindex.client.jsnodeindex.server.jsThe
typesentry should include client-only exports so that static analysis tools can resolve them.Verified in
@sentry/nextjs@10.43.0:build/types/client/index.d.tsexportscaptureRouterTransitionStartbuild/types/index.types.d.tsdoes not re-export itEnvironment
@sentry/nextjs: 10.43.0