If you have worked on a decently sized Node.js application regardless of whether its JavaScript or TypeScript, you will have come across long impor...
For further actions, you may consider blocking this person and/or reporting abuse
subpath patterns can also be used in package.json. I like to think of it as a cool free feature baked right in to nodejs.
For example:
This way, it's tied to the node project, which will work no matter what the IDE is.
Thanks a lot for sharing! I wasn't aware of this feature
Its great but unfortunately react by itse will ignore paths
I read somewhere it only doesnβt work for create-react-app, did you test it on CRA?
Since this is quite a useful trick, even though it doesn't work directly, there is a work around for it
I think it works with React as well. Tried it in a Next.js project though
For react you need third party library
I tested it right now, it's working with plain old react
weird I copy this exactly and the paths didn't work
the error:Module not found: Can't resolve '@models/tests' in '/Users/talorlanczyk/Projects/react-tests/my-app/src'
I would like you to show me the code on react please
Add the following in
webpack.config.js
:Use
yarn eject
first if you are usingcreate-react-app
Thanks,
But when i say you can't meant that you must do an additional step like eject to do this or use third party library
I think add this to your article will great for a lot of developers
You are π
π
I was using it in angular/nestJS project for a while. I had no idea it was such a big deal.
This works very well for shared libraries in a monorepos.
Yeah, it helps a lot to ease repeatative directory traversal
Absolute path really help me when use typescript. I also make boilerplate for reactjs and typescript with absolute path create-react-typescript-app.vercel...