Setup
Check the Nuxt.js documentation for more information about installing and using modules in Nuxt.js.
Nuxt.js v2.4.0+ is required, earlier versions are not supported
Installation
Add @nuxtjs/sentry
dependency to your project:
yarn add @nuxtjs/sentry
npm install @nuxtjs/sentry
Then, add @nuxtjs/sentry
to the modules
section of nuxt.config.js
and set your unique dsn
value:
{
modules: [
'@nuxtjs/sentry'
],
sentry: {
dsn: '', // Enter your project's DSN.
// Additional Module Options.
config: {
// Optional Sentry SDK configuration.
// Those options are shared by both the Browser and the Server instances.
// Browser-only and Server-only options should go
// into `clientConfig` and `serverConfig` objects respectively.
},
}
}
See Options for a list of available options.
Note that the Sentry SDK dependencies (@sentry/*
) are not pinned and can be updated independently from the module itself by running npm upgrade @nuxtjs/sentry
or yarn update @nuxtjs/sentry
. That means you don't have to wait for a new module release if you want to update to the latest SDK version.
For Typescript or type-checked JavaScript projects, you might have to install the @sentry/tracing
package even when not using the tracing functionality. In that case, the package can be installed as a dev-only dependency.
Types
In Typescript or type-checked JavaScript projects, add @nuxtjs/sentry
to the types
array in tsconfig.json
to enable module types.
{
"compilerOptions": {
"types": [
"@nuxtjs/sentry"
]
}
}