Skip to content

Commit

Permalink
fix(nextjs): Fix matching logic for file convention type for root lev…
Browse files Browse the repository at this point in the history
…el components
  • Loading branch information
lforst committed Oct 21, 2024
1 parent 7e39d04 commit 547987a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/nextjs/src/config/loaders/wrappingLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ export default function wrappingLoader(

const componentTypeMatch = path.posix
.normalize(path.relative(appDir, this.resourcePath))
// Replace all backslashes with forward slashes (windows)
.replace(/\\/g, '/')
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor
.match(new RegExp(`/\\/?([^/]+)\\.(?:${pageExtensionRegex})$`));
.match(new RegExp(`(^|/)/?([^/]+)\\.(?:${pageExtensionRegex})$`));

if (componentTypeMatch && componentTypeMatch[1]) {
let componentType: ServerComponentContext['componentType'];
Expand Down

0 comments on commit 547987a

Please sign in to comment.