You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Place NODE_PATH=src into your .env file and proceed to import components/Hello.
Reacted by Ya Zhuang, Max Donchenko and Filimon Danopoulos
Reacted by robin, bigidea-kz, Yao Zhao, Daniil Lipatkin, Tomasz Bakuła, Marko Kosir, Pedro Esperança, Minh-Phuc Tran, Misael Taveras, Surbhi Bhatnagar and 9 more
I’d say let’s just add @ support. I was resistant because I thought we’d do monorepos sooner. But since that was shelved we might as well do what Vue does.
Reacted by Dorian Amouroux, Frédérick Morin, Stefan Ly, Nikita Lebedev, studio_4, Kristjan Vool, Joshua, James Adams, Hidemi Yukita, Andy Richardson and 53 more
Reacted by Filipe Oliveira, Marko Kosir, menubase-admin, Sean Stuart Urgel and cody
Reacted by Stefan Ly, Kristjan Vool, Luke Tanner, Nando Theessen, Gabe Johnson, nico, Chris Chudzicki, ean, Maximiliano Churichi, robin and 9 more
Reacted by Stefan Ly, Kristjan Vool, Wojtek Galaj, Luke Tanner, Jakub Šoltés, Thomas Lowry, Gabe Johnson, François Cabrol, nico, ean and 11 more
Reacted by Filipe Oliveira, Cristian Sandu, Marko Kosir, menubase-admin, Sean Stuart Urgel and cody
If we had monorepo support we’d encourage people to put different top level folders into separate packages instead of having a special way to refer to the root.
Reacted by Yordis Prieto, Brody McKee, Evan Schneider and maierson
@jjvainstein rly? :) second comment in this thread
@Kepro that simple solution doesn't work for me and many other people. I tried creating that .env file with it doesn't work. So for that reason I was thinking that with the solution using eact-app-rewired plus some modification I can achieve that.
Make @ alias work by default for everyone — both in JS and TS. (this issue)
I'm sorry for the frustration this is causing. We're not asking you to convert your code to use relative paths — but please wait for either of these two issues to resolve.
3 - Add this as your first entry in tsconfig.json:
"extends": "./tsconfig.paths.json",
Now everything should work fine, just reference the src/ folder in your imports instead of @.
YES, CRA will complain about the tsconfig.json absolute paths and stuff, but... VSCode seems to work pretty well with it and I think other IDEs will just as well.
EDIT: CRA complains but don't really remove the lines because it extends from the paths.json file so it can't modify it!
This really works super awesome ..
Thanks @zaguiini ..
Reacted by Luis Felipe Zaguini, Aram, JovialJulia, Daniel Moraes, Rayan Bassetti, Aleksei Klimenko, Vlad Sabev and Gustavo Gard
Reacted by JovialJulia, Aleksei Klimenko and Gustavo Gard
Reacted by JovialJulia, Aleksei Klimenko and Gustavo Gard
baseUrl is now supported in tsconfig.json and jsconfig.json. Check out #6475 and install our alpha release if you want to try it out!
Reacted by Sam Kirkland, Sergey Zwezdin, Jayson Cleary, Jason Rushton, Evgheni Djumac, Jonathan, monsieurleberre, Aleksander Dyomin, Kamran Hamid, Alexey Kuznetsov and 4 more
Reacted by Sam Kirkland, Jonathan, monsieurleberre and Aleksander Dyomin
Reacted by alamothe
Reacted by Luis Felipe Zaguini, Jonathan, monsieurleberre, Aleksander Dyomin, Wynston Ramsay and Bohdan Khodakivskyi
Reacted by Glenn Morton, Sam Kirkland, Jonathan, monsieurleberre and Aleksander Dyomin
Activity
Timer commentedon Sep 27, 2018
Place
NODE_PATH=srcinto your.envfile and proceed to importcomponents/Hello.gaearon commentedon Sep 27, 2018
I’d say let’s just add
@support. I was resistant because I thought we’d do monorepos sooner. But since that was shelved we might as well do what Vue does.[-] Is there an equivalent for webpack.resolve.alias?[/-][+]Support absolute imports with `@`[/+]Timer commentedon Sep 27, 2018
We'll need to make sure it works with webpack (obviously), but also Jest/Flow/ESLint(?).
gaearon commentedon Sep 27, 2018
Can we just create
node_modules/@and link it?xiaoxiangmoe commentedon Sep 27, 2018
@gaearon Why does monorepos affect
@support?gaearon commentedon Sep 27, 2018
If we had monorepo support we’d encourage people to put different top level folders into separate packages instead of having a special way to refer to the root.
xiaoxiangmoe commentedon Sep 27, 2018
By the way, our individual packages in monorepo, if we don't want to publish it to NPM, how should it be named?
gaearon commentedon Sep 27, 2018
Doesn't matter.
33 remaining items
jjvainstein commentedon Feb 16, 2019
@Kepro that simple solution doesn't work for me and many other people. I tried creating that .env file with it doesn't work. So for that reason I was thinking that with the solution using eact-app-rewired plus some modification I can achieve that.
adding typescript configuration to enable absolute imports
aramvr commentedon Feb 25, 2019
Is there any news?
robertvansteen commentedon Feb 25, 2019
@aramvr there is a work-in-progress PR (#6116) and I believe the intention is to ship it with
3.0but there is still some work to do.mchurichi commentedon Mar 1, 2019
just wanted to add to @jjenzz solution that you also need to map
@to the right path if you want jest to resolve correctly... this worked for merambabusaravanan commentedon Mar 26, 2019
This really works super awesome ..
Thanks @zaguiini ..
ianschmitz commentedon Apr 19, 2019
baseUrlis now supported intsconfig.jsonandjsconfig.json. Check out #6475 and install our alpha release if you want to try it out!🎨 Support path alias
nik-lampe commentedon Apr 23, 2019
This enables me to use absolute paths, but not aliases, right?
// edit
Nevermind, just read in #6656 that it's the case