Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(nextjs): Fix matching logic for file convention type for root lev…
…el components
  • Loading branch information
Luca Forstner committed Oct 21, 2024
commit 547987a5cb0be112ea37a5856e99871c0b20f1ec
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