Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### Fixes

- Find `ios/.xcode.env` in the Expo plugin "Upload Debug Symbols to Sentry" phase when the iOS project uses Swift Package Manager instead of CocoaPods ([#6911](https://github.com/getsentry/sentry-react-native/pull/6911))
- Remove the `@sentry/browser` feedback modules and the server-only `@sentry/core` modules from native bundles built on Windows. Before this fix, `includeWebFeedback: false` made these bundles fail at launch ([#6915](https://github.com/getsentry/sentry-react-native/pull/6915))

## 8.31.0

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/js/tools/metroconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export function withSentryResolver(config: MetroConfig, includeWebReplay: boolea
const SENTRY_BROWSER_FEEDBACK_WRAPPER_RE = /\/feedback(Sync|Async)/;

function isFromSentryBrowser(originModulePath: string): boolean {
return originModulePath.includes('@sentry/browser');
return /[\\/]@sentry[\\/]browser[\\/]/.test(originModulePath);
}

/**
Expand Down Expand Up @@ -413,7 +413,7 @@ const SERVER_ONLY_MODULE_RE =
/\/(mcp-server|integrations\/(http|express|postgresjs|requestdata|consola|spanStreaming)|tracing\/(vercel-ai|openai|anthropic-ai|google-genai|langchain|langgraph)|utils\/ai)(\/|\.js|$)/;

function isFromSentryCore(originModulePath: string): boolean {
return originModulePath.includes('@sentry/core');
return /[\\/]@sentry[\\/]core[\\/]/.test(originModulePath);
}

/**
Expand Down
24 changes: 24 additions & 0 deletions packages/core/test/tools/metroconfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,18 @@ describe('metroconfig', () => {
ExpectToBeCalledWithMetroParameters(originalResolverMock, browserContextMock, wrapperModule, 'web');
});

test('removes wrapper when origin path uses Windows separators', () => {
const windowsContextMock = {
resolveRequest: jest.fn(),
originModulePath: 'C:\\project\\node_modules\\@sentry\\browser\\build\\npm\\esm\\prod\\index.js',
};
const modifiedConfig = withSentryFeedbackResolver(config, false);
const result = resolveRequest(modifiedConfig, windowsContextMock, wrapperModule, 'ios');

expect(result).toEqual({ type: 'empty' });
expect(originalResolverMock).not.toHaveBeenCalled();
});

test('keeps wrapper when origin is not @sentry/browser', () => {
const nonBrowserContextMock = {
resolveRequest: jest.fn(),
Expand Down Expand Up @@ -713,6 +725,18 @@ describe('metroconfig', () => {
});
});

test('removes module when origin path uses Windows separators', () => {
const windowsContext = {
...contextMock,
originModulePath: 'C:\\project\\node_modules\\@sentry\\core\\build\\esm\\index.js',
};
const modifiedConfig = withSentryExcludeServerOnlyResolver(config);
const result = modifiedConfig.resolver?.resolveRequest?.(windowsContext, './tracing/openai/index.js', 'android');

expect(result).toEqual({ type: 'empty' });
expect(originalResolverMock).not.toHaveBeenCalled();
});

test('does not exclude modules when origin is not @sentry/core', () => {
const nonSentryContext = {
...contextMock,
Expand Down
Loading