Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nextjs): Make SDK multiplexer more resilient #6905

Merged
merged 2 commits into from
Jan 23, 2023
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
2 changes: 1 addition & 1 deletion packages/nextjs/src/config/loaders/sdkMultiplexerLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type LoaderOptions = {
* or edge-runtime code.
*/
export default function sdkMultiplexerLoader(this: LoaderThis<LoaderOptions>, userCode: string): string {
if (!userCode.includes('__SENTRY_SDK_MULTIPLEXER__')) {
if (!userCode.includes('_SENTRY_SDK_MULTIPLEXER')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: let's please leave a comment explaining why this is a exported const in the doc string

return userCode;
}

Expand Down
6 changes: 5 additions & 1 deletion packages/nextjs/src/index.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ export * from './client';
// This file is the main entrypoint for non-Next.js build pipelines that use
// the package.json's "browser" field or the Edge runtime (Edge API routes and middleware)

// __SENTRY_SDK_MULTIPLEXER__
/**
* This const serves no purpose besides being an identifier for this file that the SDK multiplexer loader can use to
* determine that this is in fact a file that wants to be multiplexed.
*/
export const _SENTRY_SDK_MULTIPLEXER = true;
6 changes: 5 additions & 1 deletion packages/nextjs/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ export * from './server';

// This file is the main entrypoint on the server and/or when the package is `require`d

// __SENTRY_SDK_MULTIPLEXER__
/**
* This const serves no purpose besides being an identifier for this file that the SDK multiplexer loader can use to
* determine that this is in fact a file that wants to be multiplexed.
*/
export const _SENTRY_SDK_MULTIPLEXER = true;