Require a file with an identifier not located in node_modules
pRequire is a small abstraction to the
Add the following statement to your app's entry point.
This will create a GLOBAL reference to pRequire, which allows you to require modules defined in your
relative to your project root not located in
You then define keys in your
package.json that reference modules relative to the root folder.
libIndex is referencing a folder that contains index.js. It works just like
require'./index'__dirname;var base = pRequire'base';var libIndex = pRequire'libIndex';var libOther = pRequire'libOther';console.logbase libIndex libOther;
You can run
node test.js to see pRequire in action.