File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
packages/nextjs/src/config/loaders Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,12 @@ export default function wrappingLoader(
96
96
const sentryConfigImportPath = path
97
97
. relative ( path . dirname ( this . resourcePath ) , sentryConfigFilePath )
98
98
. replace ( / \\ / g, '/' ) ;
99
- templateCode = templateCode . replace ( / _ _ S E N T R Y _ C O N F I G _ I M P O R T _ P A T H _ _ / g, sentryConfigImportPath ) ;
99
+
100
+ // path.relative() may return something like `sentry.server.config.js` which is not allowed. Imports from the
101
+ // current directory need to start with './'.This is why we prepend the path with './', which should always again
102
+ // be a valid relative path.
103
+ // https://github.com/getsentry/sentry-javascript/issues/8798
104
+ templateCode = templateCode . replace ( / _ _ S E N T R Y _ C O N F I G _ I M P O R T _ P A T H _ _ / g, `./${ sentryConfigImportPath } ` ) ;
100
105
} else {
101
106
// Bail without doing any wrapping
102
107
this . callback ( null , userCode , userModuleSourceMap ) ;
You can’t perform that action at this time.
0 commit comments