The weakness of Laravel+React+Inertia is that builds take too long during deployment.
It would be fine if it just took time, but when there's insufficient memory, the build ultimately fails with a JavaScript heap out of memory error.
The solution other than increasing server memory is rolldown-vite. Just by specifying it in package.json, rolldown-vite will be used.
"vite": "npm:rolldown-vite@latest"
If you're at the stage where builds sometimes fail and sometimes succeed, this alone should solve the problem.