Delveroff
Delveroff•5mo ago

A couple of questions about tsconfig

1. What's the reason of excluding the generated folder? We import modules from it anyway, just without autocomplete. 2. How to see the code that's being sent to Convex (queries, actions, etc.). I'm mostly interested in imported "shared" modules. 3. Is it okay to include ../**/*? Of course, excluding node_modules etc. The motivation for these questions is because I consider moving Convex's tsconfig to the root:
tsconfig.base.json
tsconfig.app.json
tsconfig.convex.json
tsconfig.base.json
tsconfig.app.json
tsconfig.convex.json
That way, I could be able to freely share any code. The base config I mentioned above contains most of the options that's common between my App and Convex.
8 Replies
Delveroff
DelveroffOP•5mo ago
Also, I could have common include, exclude, and path options (if I'm not mistaken, TypeScript allowed to do this recently).
ballingt
ballingt•5mo ago
Re 1) _generated could be added, but shouldn't affect autocomplete? If it does let's change the default. 2) there's a --debug-bundle-path flag for npx convex dev that spits this out, we can unhide this 3) probably yes, at that point however I'd delete this file and use the one at the project level instead. I'm not sure about naming it tsconfig.convex.json though, I don't think esbuild will find it if it has a different name. If bundling works, and it works in your editor, it's ok. The issue is esbuild does read from the relevant tsconfig.json.
ballingt
ballingt•5mo ago
Here's the esbuild invocation, which we can allow some customization of potentially https://github.com/get-convex/convex-js/blob/main/src/bundler/index.ts#L65
GitHub
convex-js/src/bundler/index.ts at main · get-convex/convex-js
TypeScript/JavaScript client library for Convex. Contribute to get-convex/convex-js development by creating an account on GitHub.
Delveroff
DelveroffOP•5mo ago
1. I've just figured out that the problem was in my root tsconfig. Excluding the _generated folder with Convex's tsconfig does not indeed affect autocomplete. However, excluding with root's tsconfig does. 2. It would be great. For now it's unavailable. 3. There is a special flag for it. convex dev could provide that option and proxy it to esbuild.
however I'd delete this file and use the one at the project level instead.
Unfortunately, it has different options (target, lib, plugins, etc.)
ballingt
ballingt•5mo ago
@Delveroff it's accessible! It just doesn't show up in help, see the code.
Delveroff
DelveroffOP•5mo ago
Oh, I see now. I wasn't providing any argument to this flag. Wow, adding https://effect.website/ inflates a query file to 30K LoC... I don't know if this is OK.
Effect – The best way to build robust apps in TypeScript
Effect is a powerful TypeScript library designed to help developers easily create complex, synchronous, and asynchronous programs.
ballingt
ballingt•5mo ago
Generally this is fine, code loading is fast. The main thing you'll notice is slightly slower deploy times, know how many MB this is? Good idea re esbuild, I think the way we'd expose this will be a JS file since some esbuild configuration is only possible through the JS interface.
Delveroff
DelveroffOP•5mo ago
Sorry for the late response. Around 2-3MB. Agree with the config. Maybe sometime we will see convex.config.js 🙂

Did you find this page helpful?