winsoroaks
winsoroaks•8mo ago

another copy of javascript when adding tsconfig.json

i just started to add a tsconfig.json to my /convex dir and im getting a copy of js file for every ts file i wrote. this hasnt been the case in the past and i wonder if i've configured something wrongly? here's my tsconfig.json:
{
/* This TypeScript project config describes the environment that
* Convex functions run in and is used to typecheck them.
* You can modify it, but some settings required to use Convex.
*/
"compilerOptions": {
/* These settings are not required by Convex and can be modified. */
"allowJs": true,
"strict": true,
"skipLibCheck": true,

/* These compiler options are required by Convex */
"target": "ESNext",
"lib": ["ES2021", "dom"],
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"module": "ESNext",
"moduleResolution": "Node",
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["./**/*"],
"exclude": ["./_generated"]
}
{
/* This TypeScript project config describes the environment that
* Convex functions run in and is used to typecheck them.
* You can modify it, but some settings required to use Convex.
*/
"compilerOptions": {
/* These settings are not required by Convex and can be modified. */
"allowJs": true,
"strict": true,
"skipLibCheck": true,

/* These compiler options are required by Convex */
"target": "ESNext",
"lib": ["ES2021", "dom"],
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"module": "ESNext",
"moduleResolution": "Node",
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": ["./**/*"],
"exclude": ["./_generated"]
}
thank you 🙂
6 Replies
winsoroaks
winsoroaksOP•8mo ago
i manually deleted all the js files
erquhart
erquhart•8mo ago
Not sure what you mean when you say you added this, Convex generates this file in the convex directory. Did you make any specific changes?
winsoroaks
winsoroaksOP•8mo ago
nope. my convex/ dir didnt have a tsconfig originally. i just pasted the file above and got an extra copy of duplicate *.js for every file i have under convex/
erquhart
erquhart•8mo ago
This link below is what convex generates. The only difference I see is the added jsx property, but that shouldn't cause what you're seeing. The noEmit property should keep it from generating source files. https://github.com/get-convex/convex-js/blob/a38ad290a782ea491f502e032bc3d25e96ac200b/src/cli/codegen_templates/tsconfig.ts#L4
GitHub
convex-js/src/cli/codegen_templates/tsconfig.ts at a38ad290a782ea49...
TypeScript/JavaScript client library for Convex. Contribute to get-convex/convex-js development by creating an account on GitHub.
Michal Srb
Michal Srb•8mo ago
Try to exclude convex/ from your parent tsconfig? convex should not be generating js files either way, but your other build system (Vite/Next.js etc.) might.
winsoroaks
winsoroaksOP•8mo ago
that might be it ^ added /convex to exlcude in parent tsconfig

Did you find this page helpful?