Skip to content

Commit 547987a

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -182,8 +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, '/')
185187
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
186-
.match(new RegExp(`/\\/?([^/]+)\\.(?:${pageExtensionRegex})$`));
188+
.match(new RegExp(`(^|/)/?([^/]+)\\.(?:${pageExtensionRegex})$`));
187189

188190
if (componentTypeMatch && componentTypeMatch[1]) {
189191
let componentType: ServerComponentContext['componentType'];

0 commit comments

Comments
 (0)