Skip to content

Commit b6f9dc6

Browse files
authored
fix(nextjs): Fix duplicated extension when compiling sentry.server.config.js (#3597)
1 parent 4d37cd1 commit b6f9dc6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/nextjs/src/utils/config.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ const injectSentry = async (origEntryProperty: EntryProperty, isServer: boolean)
9898
// `require()` on the resulting file when we're instrumenting the sesrver. (We can't use a dynamic import there
9999
// because that then forces the user into a particular TS config.)
100100
if (isServer) {
101-
newEntryProperty[SERVER_SDK_INIT_PATH] = SENTRY_SERVER_CONFIG_FILE;
101+
// slice off the final `.js` since webpack is going to add it back in for us, and we don't want to end up with
102+
// `.js.js` as the extension
103+
newEntryProperty[SERVER_SDK_INIT_PATH.slice(0, -3)] = SENTRY_SERVER_CONFIG_FILE;
102104
}
103105
// On the client, it's sufficient to inject it into the `main` JS code, which is included in every browser page.
104106
else {

0 commit comments

Comments
 (0)