-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Set baseUrl from jsconfig.json/tsconfig.json #6656
Conversation
cheers, we neeeeeed it! |
Not sure if (or how) the tests on the CI are failing because of my changes 🤔 |
@rovansteen for the tests that failed on install: I think it should fix it. |
@eladmotola thanks, that fixed the |
@rovansteen I've fixed the behavior tests. There are a couple of last minute questions from @mrmckeb and myself and then I think we're ready to merge this. |
Thanks for everyone's work on this, especially @rovansteen! |
Congrats! |
Thanks for merging this and helping out with the final bits @iansu! 👏🏻 |
This works wonderfully, thanks @rovansteen. I think a lot of people are going to be very grateful for your work here! |
Now we just need someone to document this before the 3.0 release: #6765 |
@rovansteen Thanks to your jobs. 🎉🎉 |
Thanks for the effort. Really Really appreciated add on. |
So do we have to import |
@FezVrasta setting the For more information check out the documentation. |
@rovansteen How do we import using |
Can we define more customized path aliases like '@src', '@components', '@config', '~src', '~components', '--utils' which have been supported by Webpack and tsconfig.json many years and widely used? |
We are open to adding support for aliases in a future release. But right now it’s limited to baseUrl only. |
Awesome! This would be amazing, and I wonder if it'll be easier with this |
In one of my sample projects, I use
|
If you have a |
We are facing the same issue, does someone have an idea how to fix this? |
@silltho Check this comment it worked like a charm for me and others: #5118 (comment) |
This is a partial implementation of #6116. Because there are still a number of things that need to be figured about alias support I think it will be the best approach to add support for
baseUrl
first.This will be a breaking change and removes support for setting
NODE_PATH
in.env
file in favor of settingbaseUrl
in eitherjsconfig.json
ortsconfig.json
. It adds a warning to the start script to inform the user about this change if there is aNODE_PATH
value inprocess.env
.This PR aims to add the existing behavior of resolving modules with absolute path that already exists in CRA but in a consistent manner for both TypeScript and JavaScript projects.
Since this is a breaking change it would be nice to get this in with 3.0. After that we can create another PR to add support for aliases (like @) since that would be a non-breaking change.