#another copy of javascript when adding tsconfig.json

1 messages · Page 1 of 1 (latest)

tepid palm
#

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"]
}

thank you 🙂

#

i manually deleted all the js files

frail lance
#

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?

tepid palm
#

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/

frail lance
#

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

TypeScript/JavaScript client library for Convex. Contribute to get-convex/convex-js development by creating an account on GitHub.

thorny temple
#

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.