Skip to content

Commit e7304b2

Browse files
Merge pull request binaryoverload#3 from binaryoverload/0.4-new-integration-config
0.4 - New integration config
2 parents 5c49c16 + 034830c commit e7304b2

File tree

9 files changed

+720
-504
lines changed

9 files changed

+720
-504
lines changed

README.md

Lines changed: 19 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default defineNuxtConfig({
3737
})
3838
```
3939

40-
> [!NOTE]
4140
> You can also use environment variables to set the DSN using `NUXT_PUBLIC_SENTRY_DSN`
4241
4342
That's it! You can now use Nuxt Sentry in your Nuxt app ✨
@@ -48,7 +47,7 @@ The module can be configured by providing a `sentry` key in the `public` section
4847

4948
The `clientSdk` object is passed directly to the Sentry SDK. It consists of the properties specified in the [Sentry documentation here](https://docs.sentry.io/platforms/javascript/configuration/options/).
5049

51-
The `disableIntegrations` object takes a key of the integration name and a boolean value to enable or disable the integration. [See more details here](#disabling-integrations)
50+
The `clientIntegrations` object takes a key of the integration name and either a boolean value or the integration configuration. [See more details here](#configuring-integrations)
5251

5352
Runtime config:
5453

@@ -57,7 +56,7 @@ sentry: {
5756
enabled?: boolean // Default: Enabled in production
5857
dsn: string,
5958
clientSdk?: SdkConfig
60-
disableIntegrations?: Record<string, boolean>
59+
clientIntegrations?: ClientIntegrationConfig
6160
}
6261
```
6362

@@ -66,43 +65,16 @@ App config:
6665
```ts
6766
sentry: {
6867
clientSdk?: (app: NuxtApp) => SdkConfig | SdkConfig
68+
clientIntegrations?: ClientIntegrationConfig
6969
}
7070
```
7171

7272
### Configuring Integrations
73-
If you would like to enable or configure specific integrations or you would like to create custom integrations, you can do so by providing a `integrations` array in the `clientSdk` object in the `appConfig`. It's important to use the `appConfig` for this as integrations are not serializable and cannot be passed through the `runtimeConfig`.
74-
75-
The list of integrations is deduplicated based on the `name` property of the integration so you can configure the default integrations by adding them to the list with the desired configuration.
76-
77-
See the example below for adding and configuring integrations:
78-
79-
```ts
80-
import { breadcrumbsIntegration } from "@sentry/vue"
81-
82-
defineNuxtConfig({
83-
appConfig: {
84-
sentry: {
85-
clientSdk: {
86-
integrations: [
87-
// Configure the default Breadcrumbs integration
88-
breadcrumbIntegration({
89-
console: true,
90-
// Other options
91-
}),
92-
// Add a custom integration
93-
new MyAwesomeIntegration()
94-
],
95-
},
96-
},
97-
},
98-
})
99-
```
100-
101-
### Disabling Integrations
102-
If you would like to disable specific integrations, you can do so by providing a `disableIntegrations` object in the `runtimeConfig`. The key should be the name of the integration and the value should be a boolean to enable or disable the integration. The key is case-insensitive.
73+
If you would like to enable or configure specific integrations, you can do so by providing a `clientIntegrations` object in either `appConfig` or `runtimeConfig`. The key should be the name of the integration and the value should be either a boolean to enable or disable the integration or an object to configure the integration.
10374

10475
The default integrations that are enabled are:
10576
- Breadcrumbs
77+
- BrowserTracing
10678
- Dedupe
10779
- FunctionToString
10880
- GlobalHandlers
@@ -111,28 +83,26 @@ The default integrations that are enabled are:
11183
- LinkedErrors
11284
- TryCatch
11385

114-
See the example below for disabling the default Breadcrumbs integration:
86+
See the example below for adding and configuring integrations (You can also use `runtimeConfig` for this):
11587

11688
```ts
89+
import { breadcrumbsIntegration } from "@sentry/vue"
90+
11791
defineNuxtConfig({
118-
runtimeConfig: {
119-
public: {
120-
sentry: {
121-
disableIntegrations: {
122-
Breadcrumbs: true
123-
}
124-
}
125-
}
126-
}
92+
appConfig: {
93+
sentry: {
94+
clientIntegrations: {
95+
Breadcrumbs: false, // Disable the default Breadcrumbs integration
96+
Debug: {
97+
stringify: true, // Configure the Debug integration
98+
},
99+
HttpClient: true, // Enable the HttpClient integration
100+
},
101+
},
102+
},
127103
})
128104
```
129105

130-
or using environment variables:
131-
132-
```bash
133-
NUXT_PUBLIC_SENTRY_DISABLE_INTEGRATIONS_BREADCRUMBS=true
134-
```
135-
136106
## Development
137107

138108
```bash

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@binaryoverload/nuxt-sentry",
3-
"version": "0.3.3",
3+
"version": "0.4.0",
44
"description": "Nuxt 3 module for Sentry",
55
"repository": "https://github.com/binaryoverload/nuxt-sentry",
66
"license": "MIT",
@@ -30,7 +30,7 @@
3030
"dependencies": {
3131
"@nuxt/kit": "^3.11.2",
3232
"@sentry/vite-plugin": "^2.16.1",
33-
"@sentry/vue": "^7.113.0",
33+
"@sentry/vue": "^7.114.0",
3434
"defu": "^6.1.4"
3535
},
3636
"devDependencies": {
@@ -39,7 +39,7 @@
3939
"@nuxt/module-builder": "^0.6.0",
4040
"@nuxt/schema": "^3.11.2",
4141
"@nuxt/test-utils": "^3.12.1",
42-
"@types/node": "^20.12.8",
42+
"@types/node": "^20.12.10",
4343
"changelogen": "^0.5.5",
4444
"eslint": "^8.57.0",
4545
"eslint-config-prettier": "^9.1.0",

0 commit comments

Comments
 (0)