Skip to content

Commit 15198e3

Browse files
Don't overwrite nested default options
1 parent 21388bd commit 15198e3

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

packages/astro/src/integration/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,26 @@ export const sentryAstro = (options: SentryOptions = {}): AstroIntegration => {
6868
project: uploadOptions.project ?? env.SENTRY_PROJECT,
6969
authToken: uploadOptions.authToken ?? env.SENTRY_AUTH_TOKEN,
7070
telemetry: uploadOptions.telemetry ?? true,
71+
_metaOptions: {
72+
telemetry: {
73+
metaFramework: 'astro',
74+
},
75+
},
76+
...unstable_sentryVitePluginOptions,
77+
debug: options.debug ?? false,
7178
sourcemaps: {
7279
assets: uploadOptions.assets ?? [getSourcemapsAssetsGlob(config)],
7380
filesToDeleteAfterUpload:
7481
uploadOptions?.filesToDeleteAfterUpload ?? updatedFilesToDeleteAfterUpload,
82+
...unstable_sentryVitePluginOptions?.sourcemaps
7583
},
7684
bundleSizeOptimizations: {
7785
...options.bundleSizeOptimizations,
7886
// TODO: with a future version of the vite plugin (probably 2.22.0) this re-mapping is not needed anymore
7987
// ref: https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/582
8088
excludePerformanceMonitoring: options.bundleSizeOptimizations?.excludeTracing,
89+
...unstable_sentryVitePluginOptions?.bundleSizeOptimizations
8190
},
82-
_metaOptions: {
83-
telemetry: {
84-
metaFramework: 'astro',
85-
},
86-
},
87-
debug: options.debug ?? false,
88-
...unstable_sentryVitePluginOptions
8991
}),
9092
),
9193
],

packages/astro/test/integration/index.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,23 +202,27 @@ describe('sentryAstro integration', () => {
202202
);
203203
});
204204

205-
it('prefers user-specified unstable vite plugin options over everything else', async () => {
205+
it('prefers user-specified unstable vite plugin options and merges them with default values', async () => {
206206
const integration = sentryAstro({
207+
bundleSizeOptimizations: {
208+
excludeReplayShadowDom: true
209+
},
207210
sourceMapsUploadOptions: {
208211
enabled: true,
209212
org: 'my-org',
210213
project: 'my-project',
211214
assets: ['dist/server/**/*, dist/client/**/*'],
212-
debug: true,
213215
unstable_sentryVitePluginOptions: {
214216
org: 'my-other-org',
215217
project: 'my-other-project',
216218
applicationKey: 'my-application-key',
217-
debug: false,
218219
sourcemaps: {
219220
assets: ['foo/*.js'],
220221
ignore: ['bar/*.js'],
221222
},
223+
bundleSizeOptimizations: {
224+
excludeReplayIframe: true
225+
}
222226
}
223227
},
224228
});
@@ -238,11 +242,15 @@ describe('sentryAstro integration', () => {
238242
org: 'my-other-org',
239243
project: 'my-other-project',
240244
applicationKey: 'my-application-key',
241-
debug: false,
242245
sourcemaps: {
243246
assets: ['foo/*.js'],
244247
ignore: ['bar/*.js'],
248+
filesToDeleteAfterUpload: ['./dist/**/client/**/*.map', './dist/**/server/**/*.map'],
245249
},
250+
bundleSizeOptimizations: {
251+
excludeReplayShadowDom: true,
252+
excludeReplayIframe: true
253+
}
246254
}),
247255
);
248256
});

0 commit comments

Comments
 (0)