Skip to content

[Nuxt] No types for plugin to extend NuxAppInjections #13899

Closed
@qnp

Description

@qnp

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nuxt

SDK Version

8.33.1

Framework Version

Nuxt 3.13.2

Link to Sentry event

No response

Reproduction Example/SDK Setup

@sentry/nuxt built package file located at /build/module/runtime/plugins/sentry.client.d.ts is empty. No types are exported, therefore the NuxtAppInjection type built by Nuxt fails and resolves to any which breaks every subsequent type of plugins used as, e.g. useNuxtApp().$pinia

Example in .nuxt/types/plugins.d.ts

type NuxtAppInjections =
  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/revive-payload.client.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/head/runtime/plugins/unhead.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/router.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/payload.client.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/navigation-repaint.client.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/check-outdated-build.client.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/revive-payload.server.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/app/plugins/chunk-reload.client.js").default> &
  InjectionType<typeof import("../../node_modules/@pinia/nuxt/dist/runtime/plugin.vue3.js").default> &
  InjectionType<typeof import("../../node_modules/nuxt/dist/pages/runtime/plugins/prefetch.client.js").default> &
  InjectionType<typeof import("../../node_modules/@sentry/nuxt/build/module/runtime/plugins/sentry.client.js").default> & // fails, resolves to `any`
  InjectionType<typeof import("../../plugins/error").default> &
  InjectionType<typeof import("../../plugins/fds").default> &
  InjectionType<typeof import("../../plugins/locale").default> &
  InjectionType<typeof import("../../plugins/routes").default> &
  InjectionType<typeof import("../../plugins/store").default>

Steps to Reproduce

Install @sentry/nuxt, run nuxt so that the types are generated.
If you had any use of plugins like useNuxtApp().$pinia or so on, they are resolved to unknown which breaks the type-checking.

Expected Result

File /build/module/runtime/plugins/sentry.client.d.ts must export at least:

declare const _default: any;
export default _default;

(Would be even better if it had the full type.)

Actual Result

File is empty.

Metadata

Metadata

Assignees

Labels

Package: nuxtIssues related to the Sentry Nuxt SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions