Skip to content

Commit 1892cb0

Browse files
committed
Inherit debug option from parent config in RSC auto-instrumentation plugin
1 parent 77e55c9 commit 1892cb0

3 files changed

Lines changed: 4 additions & 8 deletions

File tree

packages/react-router/src/vite/makeAutoInstrumentRSCPlugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import type { AutoInstrumentRSCOptions } from './types';
66

77
import t = recast.types.namedTypes;
88

9+
type AutoInstrumentRSCPluginOptions = AutoInstrumentRSCOptions & { debug?: boolean };
10+
911
const JS_EXTENSIONS_RE = /\.(ts|tsx|js|jsx|mjs|mts)$/;
1012
const JS_IDENTIFIER_RE = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
1113
const WRAPPED_MODULE_SUFFIX = '?sentry-rsc-wrap';
@@ -227,7 +229,7 @@ export function getServerFunctionWrapperCode(
227229
}
228230

229231
/** @experimental May change in minor releases. */
230-
export function makeAutoInstrumentRSCPlugin(options: AutoInstrumentRSCOptions = {}): Plugin {
232+
export function makeAutoInstrumentRSCPlugin(options: AutoInstrumentRSCPluginOptions = {}): Plugin {
231233
const { enabled = true, debug = false } = options;
232234

233235
let rscDetected = false;

packages/react-router/src/vite/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function sentryReactRouter(
2121
plugins.push(makeConfigInjectorPlugin(options));
2222

2323
if (options.experimental_rscAutoInstrumentation?.enabled === true) {
24-
plugins.push(makeAutoInstrumentRSCPlugin(options.experimental_rscAutoInstrumentation));
24+
plugins.push(makeAutoInstrumentRSCPlugin({ ...options.experimental_rscAutoInstrumentation, debug: options.debug }));
2525
}
2626

2727
if (process.env.NODE_ENV !== 'development' && viteConfig.command === 'build' && viteConfig.mode !== 'development') {

packages/react-router/src/vite/types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,4 @@ export type AutoInstrumentRSCOptions = {
9494
* @default false
9595
*/
9696
enabled?: boolean;
97-
98-
/**
99-
* Enable debug logging to see which files are being instrumented.
100-
* @default false
101-
*/
102-
debug?: boolean;
10397
};

0 commit comments

Comments
 (0)