This is hardly a post, more like simple advice to anyone willing to move his/her codebase to relative paths.
I came to despise magic paths as I believe they solve no problem and usually introduce several non-trivial compilation bugs as soon as you move things around a little.
I did this kind of refactoring several times in the past and noticed that often people just go brute force at the problem, rewriting all the absolute paths one by one and wasting hours of their time.
A simple way to critically reduce the time spent on the task is to use VSCode regexp pattern matching to only target files located at a specific depth level. Assuming you have a magic path pointing to your components
folder and a project structure like this:
...
├── package.json
└── src
└── components
You can refactor it by a simple find and replace:
And then you just go recursively:
Hope this will save someone some minutes :)
Top comments (1)
thanks, helped a lot