-
-
Notifications
You must be signed in to change notification settings - Fork 27k
Allow resolving imports from src #1043
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
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! If you are contributing on behalf of someone else (eg your employer): the individual CLA is not sufficient - use https://developers.facebook.com/opensource/cla?type=company instead. Contact [email protected] if you have any questions. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
Wouldn't be better to add a "namespace" in order to avoid naming clash between packages and folders? I mean something like (not necessarily with "_"): import x from '_src_/components/x' |
considering that it will always check src folder first and |
In my opinion, I think this introduces a breaking change, right? For example, someone has a folder in src with the same name of one of their node modules. Then previously they was imported the node module, but now they will import the folder in their src, without changing anything in their code. This is of course not a common use case, but theoretically it is possible, right? |
Hi, thanks for the PR! Please search for "absolute imports" for many previous PRs that implemented the same features, and see the discussions explaining why we don't plan to take this particular implementation. Thank you! |
Here is how we intend to solve this: #741. Would you like to explore this solution? |
Typing
import x from '../../../../'
has become quite cumbersome and error prone and a lot of people (including myself) have indicated a strong desire for a better solution, e.g.import x from 'components/x.js'
.The following addition allows resolving imports from
src
.