A helper to require module relative to project root "APP_HOME" instead of current module directory.
It is not uncommon to
require modules residing in other directories from deep inside another directory,
Keeping track of relative
require becomes a
maintenance nightmare when we have a bunch of these and many directories.
apphome.js attempts to make relative
require a little bit easier to maintain. It is a simple
module that does only one thing - translate the given path relative to a known starting
To install the latest official version, use NPM:
npm install apphome
apphome.js uses the environment variable
APP_HOME to determine the root of the
APP_HOME is not set, it falls back to current working directory (as
var apphome = require'apphome';var moda = requireapphome'moda';var modc = requireapphome'moda/modb/modc';
If you prefer to use a different environment variable, say
var apphome = require'apphome';var modc = requireapphome'moda/modb/modc' 'PROJECT_HOME';
Note: For when
Proxy is supported, it will be possible to use property access to
require a module.
var apphome = require'apphome';var modc = requireapphomemodamodbmodc; //ERROR maybe in the future