-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathconfig.ts
More file actions
33 lines (27 loc) · 1.04 KB
/
config.ts
File metadata and controls
33 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import type { BuildTimeOptionsBase } from '@sentry/core';
import type { NitroConfig } from 'nitro/types';
import { createNitroModule } from './module';
import { configureSourcemapSettings } from './sourceMaps';
export type SentryNitroOptions = BuildTimeOptionsBase;
/**
* Modifies the passed in Nitro configuration with automatic build-time instrumentation.
*/
export function withSentryConfig(config: NitroConfig, sentryOptions?: SentryNitroOptions): NitroConfig {
return setupSentryNitroModule(config, sentryOptions);
}
/**
* Sets up the Sentry Nitro module, useful for meta framework integrations.
*/
export function setupSentryNitroModule(
config: NitroConfig,
moduleOptions?: SentryNitroOptions,
_serverConfigFile?: string,
): NitroConfig {
if (!config.tracingChannel) {
config.tracingChannel = true;
}
const { sentryEnabledSourcemaps } = configureSourcemapSettings(config, moduleOptions);
config.modules = config.modules || [];
config.modules.push(createNitroModule(moduleOptions, sentryEnabledSourcemaps));
return config;
}