Skip to content

fix(nextjs): Fix package.json exports #8895

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

Merged
merged 1 commit into from
Aug 29, 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
10 changes: 0 additions & 10 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
"module": "build/esm/index.server.js",
"browser": "build/esm/index.client.js",
"types": "build/types/index.types.d.ts",
"exports": {
".": {
"import": "./build/esm/index.server.js",
"require": "./build/cjs/index.server.js",
"types": "./build/types/index.types.d.ts"
},
"./requestAsyncStorageShim": {
"import": "./build/esm/config/templates/requestAsyncStorageShim.js"
}
},
"typesVersions": {
"<4.9": {
"build/npm/types/index.d.ts": [
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/src/config/loaders/wrappingLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default function wrappingLoader(
}
templateCode = templateCode.replace(
/__SENTRY_NEXTJS_REQUEST_ASYNC_STORAGE_SHIM__/g,
'@sentry/nextjs/requestAsyncStorageShim',
'@sentry/nextjs/build/esm/config/templates/requestAsyncStorageShim.js',
Copy link
Member

Choose a reason for hiding this comment

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

😢

);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,3 @@ export interface RequestAsyncStorage {
}
| undefined;
}

export const requestAsyncStorage: RequestAsyncStorage = {
getStore: () => {
return undefined;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (typeof serverComponent === 'function') {
let sentryTraceHeader: string | undefined | null = undefined;
let baggageHeader: string | undefined | null = undefined;

// We try-catch here just in case the API around `requestAsyncStorage` changes unexpectedly since it is not public API
// We try-catch here just in `requestAsyncStorage` is undefined since it may not be defined
try {
const requestAsyncStore = requestAsyncStorage.getStore();
sentryTraceHeader = requestAsyncStore?.headers.get('sentry-trace');
Expand Down