Chasing down cause of "This is probably a bug in the React Server Components bundler."
Answered
Schneider’s Smooth-fronted Caima… posted this in #help-forum
Schneider’s Smooth-fronted CaimanOP
I've got a NextJS site that's working fine, with an admin page that shows some statistics using recharts.
I decided to switch to chartjs this morning to save bundle size, removing the recharts dependency and changing the rendering code for the statistics page. Everything's great during local development: every page renders properly with no errors. When I try and build it though I get this:
If I revert the chart changes everything goes back to normal and builds succeed. If I say screw it and delete the entire scenarios folder the error persists, but happens when prerendering
How can I chase down what's causing this? I went through the suggested items on the linked docs above but none of them seem to apply. Thanks!
I decided to switch to chartjs this morning to save bundle size, removing the recharts dependency and changing the rendering code for the statistics page. Everything's great during local development: every page renders properly with no errors. When I try and build it though I get this:
Error occurred prerendering page "/admin". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Could not find the module "/workspaces/clearancelab/apps/web/src/app/admin/admin-layout-client.tsx#default" in the React Client Manifest. This is probably a bug in the React Server Components bundler.
If I revert the chart changes everything goes back to normal and builds succeed. If I say screw it and delete the entire scenarios folder the error persists, but happens when prerendering
/admin/scenarios/new
.How can I chase down what's causing this? I went through the suggested items on the linked docs above but none of them seem to apply. Thanks!
Answered by Schneider’s Smooth-fronted Caiman
I still have no idea why this unrelated change would have caused this to start happening, but I resolved it by getting rid of admin-layout-client.tsx completely.
Instead I do the permission check in layout.tsx without trying to reuse a complicated hook.
Instead I do the permission check in layout.tsx without trying to reuse a complicated hook.
1 Reply
Schneider’s Smooth-fronted CaimanOP
I still have no idea why this unrelated change would have caused this to start happening, but I resolved it by getting rid of admin-layout-client.tsx completely.
Instead I do the permission check in layout.tsx without trying to reuse a complicated hook.
Instead I do the permission check in layout.tsx without trying to reuse a complicated hook.
Answer