Skip to content

Commit

Permalink
fix(nextjs): Fix package.json exports (#8895)
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed Aug 29, 2023
1 parent 0fd86bc commit fe2c801
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 18 deletions.
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',
);
}

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

0 comments on commit fe2c801

Please sign in to comment.