inertia
inertia copied to clipboard
TypeError while accessing Inertia SSR
Version:
-
@inertiajs/react
version: 1.0.14
Describe the problem:
I have setup SSR for my Laravel Vite MUI TSX Application and it's rendering just fine in the browser and I have the feeling that SSR is working, because it's signifitant faster. The problem however is that whenever someones visits the site, I receive following error in the SSR console I started with the Artisan Command:
TypeError: Cannot read properties of undefined (reading 'default')
at file:///var/www/App/node_modules/@inertiajs/react/dist/index.esm.js:1:1529
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async j (file:///var/www/App/node_modules/@inertiajs/react/dist/index.esm.js:1:1548)
Steps to reproduce:
Just follow the steps from the guide till Hydration: https://inertiajs.com/server-side-rendering
I have this too..
same problem
same problem here
I'm also experiencing the same, and when I disable JS in my browser the page stops working, which indicates SSR is not fully working, I guess... Has anyone solved the issue?
i'm experiencing the same issue
I have this one too. It is working locally, but not on Forge.
Same error in Vue.
Hi all. You can let us know if you're experiencing the same through a 👍 on the original post. Otherwise please limit the convo to discussing the issue and possible solutions. Thanks
I don't know exactly what is the problem, but after spending many hours to make inertia ssr actually work with react mui components I found this solution:
in vite.config.js add this:
ssr: {
noExternal: [
"@mui/material",
"@mui/utils",
"@mui/base",
"@mui/icons-material",
"@mui/system",
"@mui/styled-engine",
],
},
Figured this out with the help of some great people in the discord...
You need to look at the case of the Pages folder. It was capitalized in my app.js, but in my git is was listed was pages
.
This is not a bug of SSR itself, but likely how the file is created. Check there first! And then check the case of the components folder too!
I think you can close this! @Verox001 @driesvints
Thanks!