rootrequire

npm install --save rootrequire # then `var root = require('rootrequire'), myLib = require(root + 'path/to/lib.js');`

MIT 1 个版本
安装
npm install rootrequire
yarn add rootrequire
pnpm add rootrequire
bun add rootrequire
README

rootrequire

Require files relative to your project root. Why?

  • You can move files around more easily than you can with relative paths like ../../lib/my-lib.js
  • Every file documents your app's directory structure for you. You'll know exactly where to look for things.
  • Dazzle your coworkers.

Learn JavaScript with Eric Elliott

This was written for the "Learn JavaScript with Eric Elliott courses. Don't just learn JavaScript. Learn how to change the world.

Install

npm install --save rootrequire

Use

var
  root = require('rootrequire'),
  myLib = require(root + 'path/to/lib.js');
版本列表
1.0.0 2015-02-09