A-B-Require is pretty require with absolute path. Simply Easy Smaller < 1Kb
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const mysql = require('../../../../db/mysql')
Those suck for maintenance and they're ugly. link
npm install abrequire --save
global.use = require('abrequire')
or
const use = require('abrequire')
-root
--app
----db
------mysql.js
------mongoose.js
----routes
------group
---------subGroup
------------router.js
--server.js
--node_module
--package.json
When router.js
require mysql.js
relative path
const mysql = require('../../../../db/mysql')
When router.js
require mysql.js
absolute path
const use = require('abrequire')
const mysql = use('app/db/mysql')
- Nonthachai Korninai - Github
This project is licensed under the MIT License