Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Plugin fails to read tsconfig.json with comments #3

Open
tkodev opened this issue Aug 18, 2021 · 3 comments · May be fixed by #4
Open

Plugin fails to read tsconfig.json with comments #3

tkodev opened this issue Aug 18, 2021 · 3 comments · May be fixed by #4

Comments

@tkodev
Copy link

tkodev commented Aug 18, 2021

While it is not standard practice to have comments in json files, the typescript website and many project boilerplates include comments in their tsconfig.json. These comments are usually there to describe what the tsconfig.json properties do, and the parsers for tsc and other tools seem to support them.

Is this something this plugin can look into?

@pmunin
Copy link

pmunin commented Sep 6, 2021

Confirm same issue here: tsconfig.json: Unexpected token / in JSON at position XX

@pmunin
Copy link

pmunin commented Sep 6, 2021

As a temporary workaround I used npm package: jsonc-require. Add this dependency into your package.json

In you babel.config.js:
Add first line require('jsonc-require');

If someone has time for it - please create a PR for this repo - line with require should be added to the file: babel-plugin-tsconfig-paths/lib/opts.js

@Js-Brecht
Copy link
Owner

Hey guys, sorry this fell through the cracks. I haven’t been getting notifications from this repository for some reason. I will fix that.

Thanks for the suggestion, @pmunin. That seems like a reasonable solution. Should be able to implement quickly

@Js-Brecht Js-Brecht linked a pull request Nov 15, 2021 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants