DCsan
DCsan2y ago

typescript and src/

just getting started with adding to a TS project and stuck right away when I run npx convex dev it creates a convex/_generated in the root level of my project. Instead i keep all my TS code in src/ I tried adding a symlink inside src/convex to the root level _generated
tree src/convex/
src/convex/
├── README.md
├── _generated -> ../../convex/_generated
├── getCards.ts
└── tsconfig.json
tree src/convex/
src/convex/
├── README.md
├── _generated -> ../../convex/_generated
├── getCards.ts
└── tsconfig.json
but getting:
Error: Could not find public function for 'getCards'. Did you forget to run `npx convex dev` or `npx convex deploy`?
Error: Could not find public function for 'getCards'. Did you forget to run `npx convex dev` or `npx convex deploy`?
(the convex dev script is running) is there some other magic I have to set? I note there's also a tsconfig inside the convex dir, with
"include": ["./**/*"],
"exclude": ["./_generated"]
"include": ["./**/*"],
"exclude": ["./_generated"]
I wonder if that will conflict with the rest of my app? also noting the .js files are side by side in the convex output, whereas I usually build all to /dist before deploying. using /src and /dist is fairly standard for a TS project, so maybe I'm missing something why I can't get started
8 Replies
DCsan
DCsanOP2y ago
OK seems I can workaround it if i keep all convex code outside of /src but that feels not natural...
DCsan
DCsanOP2y ago
thanks! if you could help with #subscribe question too would appreciate it
beingkartik
beingkartik12mo ago
I am also getting the same issue
ballingt
ballingt12mo ago
@beingkartik could you open a new support thread? I'm not sure which part you you are stuck on.
beingkartik
beingkartik12mo ago
I am using ts in node js and its generating a dist folder after the project is build but in dist folder I can't see _generated folder inside convex folder. And thats why getting this error
Error: Cannot find module '../../convex/_generated/api'
Error: Cannot find module '../../convex/_generated/api'
@ballingt
ballingt
ballingt12mo ago
Could you open a new support thread and share more details about your setup? It sounds like you're not using a bundler, you're using TypeScript directly to compile, is that right?
beingkartik
beingkartik12mo ago
Okay.Yeah right

Did you find this page helpful?