Skip to content

feat(nuxt): Add enabled to disable Sentry module #15337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/nuxt/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ type SourceMapsOptions = {
* Build options for the Sentry module. These options are used during build-time by the Sentry SDK.
*/
export type SentryNuxtModuleOptions = {
/**
* Enable the Sentry Nuxt Module.
*
* @default true
*/
enabled?: boolean;

/**
* Options for the Sentry Vite plugin to customize the source maps upload process.
*
Expand Down
4 changes: 4 additions & 0 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export default defineNuxtModule<ModuleOptions>({
},
defaults: {},
setup(moduleOptionsParam, nuxt) {
if (moduleOptionsParam?.enabled === false) {
return;
}

const moduleOptions = {
...moduleOptionsParam,
autoInjectServerSentry: moduleOptionsParam.autoInjectServerSentry,
Expand Down
Loading