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
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.
The text was updated successfully, but these errors were encountered:
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
JSON, parse, jsconfig
Environment
Steps to Reproduce
jsconfig.json
ortsconfig.json
Expected Behavior
Since VSCode treats both
tsconfig.json
andjsconfig.json
asJSON 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:
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.The text was updated successfully, but these errors were encountered: