This documented collects tips and tricks for debugging common issues. If you'd like to see a workaround documented here, please submit it to our GitHub issues.
If you see an error while rendering from the server, it can often be hard to diagnose. There's a few ways to debug it.
First, we've found turning off Vite external dependencies entirely will often help, what it does is make Vite use esbuild and apply CommonJS transforms for compatibility, transforming all of them into your .vite directory. You can enable it like so:
vite.config.ts
{
ssr:{
noExternal:true
}
}
The reason we don't turn this on by default it is can cause other issues, namely if a node module relies on, say, __dirname, or __filename, then when they are transformed into the .vite folder these paths will change. Another reason we don't turn it on by default is that it can slow things down.
If you do find the individual module that is causing an issue, you can also configure it quickly using the deps option in the One Vite plugin configuration.
In general you want to add any dependency like this to optimizeDeps.exclude. But One has some default optimizeDeps options we add that may prevent that.
You can use fixDependencies in your vite.config.ts: