Skip to content

Commit 8b46a6c

Browse files
committed
fix(nextjs): Fix matching logic for file convention type for root level components
1 parent 7e39d04 commit 8b46a6c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/nextjs/src/config/loaders/wrappingLoader.ts

+4
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ export default function wrappingLoader(
182182

183183
const componentTypeMatch = path.posix
184184
.normalize(path.relative(appDir, this.resourcePath))
185+
// Replace all backslashes with forward slashes (windows)
186+
.replace(/\\/g, '/')
187+
// Add a slash at the beginning
188+
.replace(/(.*)/, '/$1')
185189
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
186190
.match(new RegExp(`/\\/?([^/]+)\\.(?:${pageExtensionRegex})$`));
187191

0 commit comments

Comments
 (0)