You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tsconfig.json and jsconfig.json not allowing comments (parsed as pure JSON) #7195
use a comment or leave a trailing comma in an array or an object
Expected Behavior
Since VSCode treats both tsconfig.json and jsconfig.json as JSON with Comments by default, it does not report any issues when adding comments or leaving trailing commas inside those files. As such I would expect the files to be parsed correctly and comments to be allowed.
Actual Behavior
The build fails as the aforementioned additions, which is to be expected if the files are treaded as pure JSON. The following output is produced when comments are present in the config:
yarn run v1.16.0
$ react-scripts build
internal/modules/cjs/loader.js:711
throw err;
^
SyntaxError: /.../app/jsconfig.json: Unexpected token / in JSON at position 3
at JSON.parse (<anonymous>)
Reproducible Demo
It should be fairly easy to quickly reproduce this issue in an empty create-react-app project.
Additional info
This issue is connected to #4763 although I believe this to be a bug. If this is indeed intended (I understand this is an issue with how cjs parses the files) I'd ask to at least have this behaviour mentioned in the documentation as it seems to diverge from the way that {ts,js}config.json files are treated by default.
Activity
heyimalex commentedon Jun 11, 2019
Duplicate of #6865.
EDIT: Or err... close enough to be a duplicate. I realize now this also applies to jsconfig.json.