-
-
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
Conflict using absolute path #7795
Comments
You are saying you have an |
Update issue with missing |
Can confirm. Typescript attempts to look for an npm package with that name before resolving to src folder. I encountered this with a folder called |
Do you have a directory in your |
This really isn’t scalable or ideal. Any of your dependencies could have a dependency of their own with a similar name of your folder and everything will break. Don’t think we should be recommend this at all. The tsconfig paths solution or webpack alias is a much better approach |
I understand, but that's how node works. That's why we added the option to set |
Yes i have a folder inside node modules called Just a little question about this : What are you plan for this feature ? i read that you also think about supporting Workspaces (Lerna, Yarn ). Do you plan to provide |
I don't know if we will add support for |
Okay. i'll stay with |
Describe the bug
I found an example using absolute Import in CRA project. I try following the documentation to add this to my project because i have multiple long relative path and that could help me. And i have a folder
base
(maybe bad choice ) where i put all my "reusable components" most of them created from 'styled-components'. And inside this repository i have an index.html which export all component :and if i tried :
it crash because it try to import from a file in
node_modules
.but work with
Did you try recovering your dependencies?
Don't seems to be related to dependencies.
❯ yarn --version
1.19.0
Which terms did you search for in User Guide?
I look at
absolute imports
in CRA documentation and I read a lot of issue post related too but find nothing about conflictSteps to reproduce
(Write your steps here:)
Expected behavior
I expect to be able to import the same way i do with relative path. That mean that if i have a folder
base
with index.js i expect to be able to import directly frombase
instead of requiring each file inside the folderActual behavior
It's not possible to import from
base
orbase/index
. The only import working is to import directly frombase/box
which can be really annoying if you need to import from 5/6 different files insidebase
when importing from
base
orbase/index
Workaround (Maybe)
Using a baseUrl as
.
and try importsrc/base
instead as it should resolve the name conflictReproducible demo
I'm sorry i can't provide a demo. Try to put it on CodeSandbox but can't create
jsconfig.json
The text was updated successfully, but these errors were encountered: