Skip to content

Commit 98fe20d

Browse files
committed
.
1 parent 033b81e commit 98fe20d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/nextjs/src/common/devErrorSymbolicationEventProcessor.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ const globalWithInjectedValues = GLOBAL_OBJ as typeof GLOBAL_OBJ & {
1717

1818
/**
1919
* Constructs the base URL for the Next.js dev server, including the port and base path.
20-
* Returns an empty string when running in the browser (client-side).
20+
* Returns only the base path when running in the browser (client-side) for relative URLs.
2121
*/
2222
function getDevServerBaseUrl(): string {
23-
// eslint-disable-next-line no-restricted-globals
24-
if (typeof window !== 'undefined') {
25-
return '';
26-
}
27-
28-
const devServerPort = process.env.PORT || '3000';
2923
let basePath = process.env._sentryBasePath ?? globalWithInjectedValues._sentryBasePath ?? '';
3024

3125
// Prefix the basepath with a slash if it doesn't have one
3226
if (basePath !== '' && !basePath.match(/^\//)) {
3327
basePath = `/${basePath}`;
3428
}
3529

30+
// eslint-disable-next-line no-restricted-globals
31+
if (typeof window !== 'undefined') {
32+
return basePath;
33+
}
34+
35+
const devServerPort = process.env.PORT || '3000';
3636
return `http://localhost:${devServerPort}${basePath}`;
3737
}
3838

0 commit comments

Comments
 (0)