absolute-require-bono
Transform your code, and go from using slow laborious relative to using absolute paths relative to your apps root directory. makes finding dependant modules a breeze.
Well i wish it was 2 lines, but getting absolute bin paths for npm was abit of struggle, that and deciding is it programattically acceptable to change babel configs not knowing where they are.
1. Install
$ npm install absolute-require-bono$ npm install -g jscodeshift
2. Transform from Relative to Absolute paths
$ jscodeshift -t node_modules/absolute-require-bono/codeshift.js src/
where src/
is your projects javascript folder
import
with babel?
3. are you using $ npm install babel-plugin-root-import
and add the following plugin to .babelrc
plugins
"plugins":
4. add require line at node entry point
// app.js
Done. want to reverse back to realtive paths
$ jscodeshift -t
node_modules/absolute-require-bono/codeshift.js src/ --reverse
that and removing babel config.