Skip to content

Commit

Permalink
Merge pull request #8142 from timfish/fix/nextjs-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst committed May 17, 2023
2 parents 60a60ad + 389cfd3 commit 061eca5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/nextjs/src/config/loaders/wrappingLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,15 @@ export default function wrappingLoader(
}

if (sentryConfigFilePath) {
templateCode = `import "${sentryConfigFilePath}";`.concat(templateCode);
let importPath = sentryConfigFilePath;

// absolute paths do not work with Windows
// https://github.com/getsentry/sentry-javascript/issues/8133
if (path.isAbsolute(importPath)) {
importPath = path.relative(path.dirname(this.resourcePath), importPath);
}

templateCode = `import "${importPath.replace(/\\/g, '/')}";\n`.concat(templateCode);
}
} else if (wrappingTargetKind === 'middleware') {
templateCode = middlewareWrapperTemplateCode;
Expand Down

0 comments on commit 061eca5

Please sign in to comment.