diff --git a/packages/nuxt/src/common/types.ts b/packages/nuxt/src/common/types.ts index 8a9a453ff7db..b646ca9a25e2 100644 --- a/packages/nuxt/src/common/types.ts +++ b/packages/nuxt/src/common/types.ts @@ -8,6 +8,50 @@ export type SentryNuxtClientOptions = Omit[0] & objec export type SentryNuxtServerOptions = Omit[0] & object, 'app'>; type SourceMapsOptions = { + /** + * Suppresses all logs. + * + * @default false + */ + silent?: boolean; + + /** + * When an error occurs during release creation or sourcemaps upload, the plugin will call this function. + * + * By default, the plugin will simply throw an error, thereby stopping the bundling process. + * If an `errorHandler` callback is provided, compilation will continue, unless an error is + * thrown in the provided callback. + * + * To allow compilation to continue but still emit a warning, set this option to the following: + * + * ```js + * (err) => { + * console.warn(err); + * } + * ``` + */ + errorHandler?: (err: Error) => void; + + /** + * Options related to managing the Sentry releases for a build. + * + * More info: https://docs.sentry.io/product/releases/ + */ + release?: { + /** + * Unique identifier for the release you want to create. + * + * This value can also be specified via the `SENTRY_RELEASE` environment variable. + * + * Defaults to automatically detecting a value for your environment. + * This includes values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. + * (the latter requires access to git CLI and for the root directory to be a valid repository) + * + * If you didn't provide a value and the plugin can't automatically detect one, no release will be created. + */ + name?: string; + }; + /** * If this flag is `true`, and an auth token is detected, the Sentry SDK will * automatically generate and upload source maps to Sentry during a production build. diff --git a/packages/nuxt/src/vite/sourceMaps.ts b/packages/nuxt/src/vite/sourceMaps.ts index 0b264e822bcc..4f1e1184e637 100644 --- a/packages/nuxt/src/vite/sourceMaps.ts +++ b/packages/nuxt/src/vite/sourceMaps.ts @@ -93,6 +93,12 @@ export function getPluginOptions( telemetry: sourceMapsUploadOptions.telemetry ?? true, url: sourceMapsUploadOptions.url ?? process.env.SENTRY_URL, debug: moduleOptions.debug ?? false, + silent: sourceMapsUploadOptions.silent ?? false, + errorHandler: sourceMapsUploadOptions.errorHandler, + release: { + name: sourceMapsUploadOptions.release?.name, + ...moduleOptions?.unstable_sentryBundlerPluginOptions?.release, + }, _metaOptions: { telemetry: { metaFramework: 'nuxt',