Skip to content
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

Support "extends" tsconfig directive #300

Closed
raythurnvoid opened this issue Jan 24, 2021 · 3 comments · Fixed by #328
Closed

Support "extends" tsconfig directive #300

raythurnvoid opened this issue Jan 24, 2021 · 3 comments · Fixed by #328
Assignees
Labels
help wanted Extra attention is needed

Comments

@raythurnvoid
Copy link

Is your feature request related to a problem? Please describe.
svelte-preprocess seems to not follows the extends directive provided in a tsconfig.

Describe the solution you'd like
Using typescript.parseJsonConfigFileContent should do the trick.

How important is this feature to you?
It's not blocking, since i could implement my custom tsconfig file reader, but it would be nice to have this feature built-in.

@kaisermann
Copy link
Member

Hey @raythurnevoid 👋

If I'm not mistaken, the parseJsonConfigFileContent needs a valid ParseConfigHost, which is a bit too much for this IMO. Can you check if #302 would be enough?

@raythurnvoid
Copy link
Author

raythurnvoid commented Feb 1, 2021

Thank you for the reply!
Unfortunately it's not enough :(.
There are two main issues, it's not recursive and require will break with comments in tsconfig.json (which "@tsconfig/svelte/tsconfig.json" has).

Actually also ts-loader takes advantage of parseJsonConfigFileContent; it woud allow you to avoid much custom code with the confidence of it working in all occasions.
I know you need ParseConfigHost but you can easily overcome this by passing the sys object exposed under "typescript" package as achieved by ts-loader.

Don't know if it is of any help, i show you what i came up so far. It doesn't use parseJsonConfigFileContent since i have to pass a compilerOptions object in the same format of a regular tsconfig.json to the svelte-loader, and parseJsonConfigFileContent unfortunately doesn't provide it. The problem of my implementation is that it doesn't work with globally installed node_modules and neither with node_modules present in parent folders of the cwd.

@kaisermann
Copy link
Member

@raythurnevoid Thanks for the reference links! I will take a look at them and see what I come up with.

@kaisermann kaisermann added the help wanted Extra attention is needed label Feb 3, 2021
dummdidumm pushed a commit to dummdidumm/svelte-preprocess that referenced this issue Mar 11, 2021
kaisermann pushed a commit that referenced this issue Mar 26, 2021
* (feat) Support tsconfig extends

Fixes #300

* lint

Co-authored-by: Simon Holthausen <simon.holthausen@accso.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
2 participants