-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] expose tsconfig parser to js api #1515
Comments
Yes, this is unfortunate. I really wish the TypeScript team hadn't done this but that ship has sailed. It turns out The The simplest way to do this would be to just use The next simplest way to do this would be to use your own parser, either a third-party package like This functionality is independently useful to developers outside of the esbuild ecosystem and it would be hugely inefficient to require people to install esbuild (a 7mb binary executable) just to parse a |
Thank you for your detailed response and i very much agree that TypeScript should either have used plain json or a different extension + a more usable api for parsing. I thought about eval too, but the extended tsconfig could be in a package as well and even So it looks like the best way forward would be to provide a separate package that uses |
a way forward? https://github.com/dominikg/tsconfck |
Problem
vite 2.5 (currently in beta) uses a custom implementation to read tsconfig to pass some compilerOptions on to esbuild
The current implementation has several shortcomings:
Solution
It would be great to be able to use esbuild to parse tsconfig instead
Just a simple
parseTSConfig(filename)
that returns an object with extends already resolved.Alternatives considered
An optional peer dependency on typescript to use typescripts own utilities.
Unfortunately that blows up vites build and has a very complicated api.
Improving the existing custom parser by patching the bugs mentioned above.
Started it on tsconfig repo but i'd prefer esbuilds parser as it already is a vite dependency
The general usecase for esbuild
Even though esbuild has options to reference tsconfig files on some of its api, i think it would be generally useful for advanced usage like above to be able to get a resolved tsconfig object for inspection.
The text was updated successfully, but these errors were encountered: