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

Is it true that you can use a jsconfig.json ? #8782

Closed
sarah11918 opened this issue Jul 11, 2024 · 5 comments · Fixed by #8818
Closed

Is it true that you can use a jsconfig.json ? #8782

sarah11918 opened this issue Jul 11, 2024 · 5 comments · Fixed by #8818
Labels
good first issue Good for newcomers help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. help wanted Issues looking for someone to run with them! improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)

Comments

@sarah11918
Copy link
Member

📚 Subject area/topic

import aliases

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/guides/aliases/

📋 Description of content that is out-of-date or incorrect

From feedback fish:

I tried setting up import aliases with a jsconfig.json file, per the docs. And this seemed to be ignored. I switched over to a tsconfig.json file, and everything worked as expected. Does this page need to be updated or is this a bug?

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

@sarah11918 sarah11918 added improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. good first issue Good for newcomers help wanted Issues looking for someone to run with them! labels Jul 11, 2024
@Fryuni
Copy link
Member

Fryuni commented Jul 13, 2024

jsconfig.json is the same as tsconfig.json but with allowJs implied to be true.

This feature comes from Vite, it is even used on some of their examples, so it should just work. Astro doesn't do anything special regarding that. Might be worth looking into whether something we set implicitly disables this.

@sarah11918
Copy link
Member Author

Thanks Fyuni!

@Princesseuh - would you be able to confirm here whether there might be anything we do that makes jsconfig.json wonky, or not "just work"?

As with all Feedback Fish reports, it's a single user so a very specific problem with an individual project is always a possibility! But I'm also not sure how many people are actually using jsconfig vs tsconfig, so it might be worth taking a peek at even one report.

@Princesseuh
Copy link
Member

Princesseuh commented Jul 15, 2024

It is true, it should work, however I would never recommend it. jsconfig.json is not exactly a standard, it's kinda a thing the VS Code team made up.

Since it's so rare, we don't test it often (I think we do have a test for it in the core repo, not sure), nor does any of our dependencies (we do a fair amount of tsconfig things ourselves, using the same library that Vite uses)

@sarah11918
Copy link
Member Author

OK, sounds like we should maybe just remove the suggestion and stick to the standard?

Our base configuration includes allowJS; true, so it should be good enough to just standardize and only document tsconfig.json.

Unless anyone screams loudly in protest, I'll remove mention of also being able to use jsconfig.json. Thanks everyone!

@sarah11918
Copy link
Member Author

GOOD FIRST ISSUE TASK:

Find everywhere in the docs that jsconfig.json is mentioned as an alternative to tsconfig.json and remove it. (Updating all sentences appropriately now that there is only one option instead of two).

There is no need to mention that "this used to be allowed/recommended", nor any need to mention that it can be used but is not recommended. All changes should pretend jsconfig.json does not exist, and never existed. No one's project will break if they still have it, and people who know what to do won't be affected and are welcome to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. help wanted Issues looking for someone to run with them! improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants