Tsup doesn't accurately collect tsconfig.json preferences
See original GitHub issueAfter some testing, it looks like tsup doesn’t resolve tsconfig extensions. For example, if my tsconfig was:
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "."
}
}
And ../tsconfig.base.json
was:
{
"compilerOptions": {
"emitDecoratorMetadata": true
...
}
}
Tsup wouldn’t detect any of the extended options, such as emitDecoratorMetadata
. This seems to be because you only read the file through fs.readFileSync
and use the results directly. However, I believe you need to use typescript’s compiler API to get the full contents. Something like this:
const parsedTsConfig = typescript.parseJsonConfigFileContent(tsconfig, typescript.sys, outDir);
You can find a good example of that here, and I could also probably make PR if needed.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Tsup doesn't accurately collect tsconfig.json preferences
Tsup doesn't accurately collect tsconfig.json preferences. ... After some testing, it looks like tsup doesn't resolve tsconfig extensions.
Read more >tsc apparently not picking up tsconfig.json · Issue #6591 - GitHub
The problem is that tsconfig.json isn't considered when you manually specify your source files on the command line. It's certainly not great ...
Read more >TypeScript `tsc` not picking up tsconfig.json inside a ...
TypeScript only uses one tsconfig.json and doesn't automatically use subdirectories' tsconfig.json for the files there.
Read more >TSConfig Reference - Docs on every TSConfig option
Intro to the TSConfig Reference A TSConfig file in a directory indicates that the directory is the root of a TypeScript or JavaScript...
Read more >Typescript does not resolve modules through tsconfig.json's ...
The problem is that you have "files":[] section that only includes a file from typings. If there is a 'files' section in tsconfig.json,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This should be fixed in 5.11.12, please give it a try
btw I made a package for this: https://github.com/egoist/load-tsconfig (even more light-weight than tsconfig-loader)
Great, thank you so much!
Can I also make a PR that adds the option to force tsup to use esbuild over swc, even if the emitDecoratorMetadata is enabled somewhere?(Nevermind, I just won’t install@swc/core
)