It seems to me that the problem would be caused by Mongoose packing, rather than vite/rollup’s build, since it seems to run fine on your development environment.
PS: Could you try reproducing the Problem using a mongoose server running on your development machine, or even better: on a Dockerfile? Then you could share a minimal example that could help to further diagnose the issue.
I understand your project’s constraints. I meant that you could try compiling and running the mongoose server linked against the packed filesystem in your development machine.