-
-
Notifications
You must be signed in to change notification settings - Fork 27k
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
tsconfig.json gets overwritten preventing real configuration #8614
Comments
Seems there is a comment saying that it's not supported right now. as an alternative/workaround, we could set Note: edited to correct and clarify the actual current state of paths in create-react-app |
Here's an example sandbox with using |
Thanks @hrgui for this great discovery. I see it's really working in the sandbox, so I'll try it tomorrow in my project and write back. |
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs. |
This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue. |
I like CRA, especially now when I learned how to override some of its configs thanks to beautiful https://github.com/gsoft-inc/craco
And the first thing I use craco for - is fixing webpack config setting up project resolves and aliases.
For example, this
craco.config.js
:adds two aliases:
components
andstate
allowing us to import things using sensible paths (at long last):and this works perfectly, but only for JavaScript, not for TypeScript. And this despite they state it should acquire path resolutions from webpack, but this never happens, probably because of craco.
To workaround this one needs to provide additional configuration for TypeScript in
tsconfig.json
:but.. this is not going to work anyway, because react-scripts is overwriting tsconfig.json, removing "paths" section! As result I had to eject the project just to get this silly resolution working. I think this is a bug, because as I said overriding webpack resolve via craco works fine for JavaScript and thus must also work for TypeScript.
The text was updated successfully, but these errors were encountered: