File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
packages/nextjs/src/common Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff 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 */
2222function 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
You can’t perform that action at this time.
0 commit comments