Answer the question
In order to leave comments, you need to log in
How to compile several files in different directories and also spread the compilation result into different directories?
Hello. I write on TS back and front.
Directory of the following due to:
├── api
│ ├── api-core.ts
│ └── interfaces.ts
├── server
├── serverTs
│ └── server.ts It is
necessary to configure config tsc so that files compiled in serverTs got into the server, but what is going to the api remained in the api. Tell me, is it even possible to do this without assemblers? Now I use esbuild, but it does not show tsc errors, that is, if there is a problem with types somewhere, I will not see it. Maybe there is some small bundle that (not webpack) could suit my needs. And in general, how are large projects written on TS, or do such problems usually not arise?
I can’t share, since the same api is used both on the back and on the front. I don’t see much point in collecting everything in one, since http2 works for modern browsers and can be loaded into several files
Answer the question
In order to leave comments, you need to log in
tsc itself builds files 1 to 1 by default. It is the assemblers who then put everything together. The solution is not to use a builder.)
If the target is only the most up-to-date, you can generally use target esnext, script type="module" and a fresh node with esm support.)
For such things, assemblers are used.
For example, Rollup or Vite .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question