-
-
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
Absolute file paths #3554
Absolute file paths #3554
Conversation
Sorry but we won't be accepting this in its current form. The official solution currently is to use Please search for previous issues and pull requests for context. Thanks for your contribution! |
Can you provide context? All I'm finding is people complaining about this not being a feature, getting the |
Webpack resolving alias provides us the ability to alias directory to '@src' / '~src' with special symbols that we easily distinguish some package comes from the project root path or relative path. |
@Timer is there any ability to reconsider this? It seems like there is quite a bit of demand to not pin everything to |
This would be a great addition. And not just for aliasing |
@Timer This is the situation I'm in where the conclusion is that it is "...appropriate to say that npm-linking will not work with create-react-app/react-scripts and styled-components unless you "eject" create-react-app and add that configuration". What I want to know is if ejecting is the only solution today and there won't be a solution within CRA to avoid ejecting in the future. |
@rahmen86 does this tutorial help? It uses CRA with styled components and redux https://gitconnected.com/courses/learn-react-redux-tutorial-build-a-hacker-news-clone |
I did some additional testing and I realized that I can actually run
So my problem is actually solved. And it seems like the comment in styled-components/styled-components#1770 is at least partly wrong:
I'm running CRA with I'm not sure I'm writing in the correct thread - but if someone else follows the same path I hope that this post helps. |
@treyhuffine Unix |
I just looked over @treyhuffine 's PR's for this. What an awesome contribution this is would be! I am completely baffled as to why this approach was rejected in favor of assigning to NODE_PATH. :-( For those who are interested, Next.js allows you to add custom aliases and you also get Server-side rendering for free. Create-react-app is awesome, but there are other alternatives if you need this functionality. We use CRA and opted to eject so we could tailor it to our needs, this is the approach I'd recommend. |
There is now the ability to declare
alias
in the package.json so that absolute file paths can be constructed. I've added thesrc
folder by default to expose the pattrn.