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
fix: support dangling comma and throw on circular dependency in tsconfig #4590
Conversation
By implementing tsconfig resolve/parse/load logic in vite. Much of the code is from the `tsconfig` package and thanks to @dominikg Fixes vitejs#4481 Fixes vitejs#4512
😂 I've added the comma! It was formatted by prettier… |
i've played with the idea of spinning tsconfig-parse as a new package - a more modern version of see also evanw/esbuild#1515 (comment) let me know if you'd be fine with me reusing the resolution code and if you'd be willing to swap it out in vite then. |
Yeah, that would be cool! I worked on this PR mainly to unblock the release of v2.5. |
Regarding error reporting, JSON.parse error position should match the position in invalid tsconfig.json content so this should be enough here. Semantic errors would need either tsconfig schema validation or again using typescript api. I'll think about adding that to the package at some point then ;) |
…fig (vitejs#4590) Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
Description
By implementing tsconfig resolve/parse/load logic in vite.
Much of the code is from the
tsconfig
package and thanks to @dominikgFixes #4481
Fixes #4512
Additional context
strip-bom
v4 is used instead of v5, because v5 is a native ES module, causing jest tests to fail.No tests are added for the circular dependency issue because I don't yet know how to test it.
If we need better error messages,
json5
can be used.I've considered using
jsonc-parser
, but it outputs error messages for trailing commas despite successfully parsing it.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).