-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Support JSONC format for jsconfig.json #8140
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
Conversation
Probably I missed something but as I can see now we assume that typescript is installed based on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @esvyridov! This looks good overall, but I'd be interested in getting some feedback from another team member.
@@ -130,7 +134,39 @@ function getModules() { | |||
// Otherwise we'll check if there is jsconfig.json | |||
// for non TS projects. | |||
} else if (hasJsConfig) { | |||
config = require(paths.appJsConfig); | |||
if (hasTsSetup) { | |||
const ts = require(resolve.sync('typescript', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than using hasTsSetup
, I think you could just do a try/catch here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
I've tagged this for 3.4, and will ask another team member to review. |
Can this be merged please? I’ve just
It’s really hard to find this with all the issue locking |
Can I circumvent this bug in some way until this is merged? Tell CRA to ignore the file? I don’t want to make my config files worse by deleting perfectly fine comments. |
Hi! Thanks for the work! What is the current state for this PR? It'd be really useful to be able to have nice comments on our json files. |
Closes #7426.
To verify my changes I've used

yarn create-react-app my-app
insidecreate-react-app
. Then I createdjsconfig.json
file with comments and runyarn start
. I saw this error:After I run
yarn add typescript
the error is gone.Note: I've noticed a problem in
getModules
. Please check comments