One of the things that held me back from Create React App was the lack of absolute imports. I loved them so much in my custom webpack config that I...
For further actions, you may consider blocking this person and/or reporting abuse
Weird. This doesn't work for me :/
try restart react app?
it turned out I need to set
"baseUrl": "./src"
instead of"baseUrl": "src"
in my case.What's the error? Is it during bundling or in runtime?
No error log per se but the absolute import just didn't work so I need to resort to set
NODE_PATH='src/'
in.env
to make it work which is already deprecated.I tried this , It worked ......But when I tried to deploy my app on netlify , It failed on Build process with error
Cannot find module: 'components/Footer'. Make sure this package is installed.
How to use fix this on netlify ?
This is great timing, I was just looking into how to do this and a solution that I tried using an .env file was not working, and this right here did the trick. Thanks a lot!
Love to hear that!
Thanks a lot! Have you any tips in case if I want organize paths for styles structure? What should I do with imports in scss files?
Awful solution by the React team. What if I have a dir called
lodash
. How do I know if is importing the npm package or my dir?In that case you would do
"baseUrl": "./",
and import from your dir usingsrc/lodash
Legend!
THANKS A LOT!
nice! it's work
Thanks a lot.
Thank you @michal , I just looking for absolute path in app, Now its working.
at the place of "src" put "./src", in VS code. It will suggest path.
🚀
It couldn't have been this simple. Kudos Bro.
Thank you so much
If dosent work, try to install "react-scripts": "^5.0.0",
It worked great. Thanks.