Hi everyone I m trying to setup convex
Hi everyone! I'm trying to setup convex in a nestjs backend.
Even on dev server nest build all files and serve from dist with watch mode. I'm experiencing a problem with imports inside the dist. looks like it cant find
../convex/_generated/api
.
I guess it's related to typescript configuration but can't figure it out for a while. someone have any idea what might be the problem?
Attaching pictures of relevant files, thanks in advance!



3 Replies
A couple ideas, can you say more about "dist," how is that related?
Are you compiling this with TypeScript into a dist directory?
It looks like yes so the relative path to these files changes when accessed from src vs dist, but they aren't being compiled so they aren't being moved.
Can you try setting
allowJs: true
in that tsconfig.json? That way it should also compile these generated Convex files.
There are some hackier workarounds we could try if this doesn't workWorked like a charm! thanks a lot!
@Tom By the way, what's the recommended way of working with convex in 2 different repos connected to the same convex project? I guess having the same schema in both isn't a good practice. any reccomendations?
It's most convenient currently to use Convex in a monorepo so there are not API skew issues. If you only one of these repos should have Convex functions in it, since one would overwrite the other when deploying.
There are plans for a way to generate code for an API spec that you could use in another repository and manage updating yourself, but currently to get the TypeScript types you need to have access to the source files — so there's no great way to do this. The recommended path is a monorepo, similar to tRPC.