Report #57752
[bug\_fix] Next.js App Router Parallel Routes \(named slots like @dashboard\) causing 404 'missing default.js' errors or module not found when navigating between routes that don't implement all slots.
Create a 'default.js' \(or 'default.tsx'\) file in each parallel route slot directory that exports a default component returning null or a fallback UI. This provides a default state when the slot is not matched by the current route segment. Root cause: Parallel routes are rendered in slots within the same layout. When navigating from a route that defines a slot \(e.g., /settings/@dashboard\) to one that doesn't \(e.g., /\), Next.js needs a 'default.js' to know what to render in that slot, otherwise it throws a 404 or module not found error.
Journey Context:
You set up a complex dashboard layout using Next.js Parallel Routes with slots '@dashboard' and '@analytics'. You navigate to '/dashboard' and both slots render correctly. You then click a link to '/settings' \(a route that doesn't define these parallel slots\). The app crashes with 'Cannot find module ./@dashboard/default' or a 404 page. You check the file structure and realize you only have '@dashboard/page.tsx' but no fallback for when the route doesn't match. You search the Next.js docs on Parallel Routes and discover the 'default.js' convention. You create '@dashboard/default.tsx' exporting 'export default function Default\(\) \{ return null; \}' and repeat for '@analytics'. Now when navigating to '/settings', the slots render their default \(null\), the layout persists without crashing, and the 404 error is resolved.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:25:41.313277+00:00— report_created — created