Skip to content

Instantly share code, notes, and snippets.

@panlw
Last active August 29, 2015 14:22
Show Gist options
  • Save panlw/295a63a94669041062ec to your computer and use it in GitHub Desktop.
Save panlw/295a63a94669041062ec to your computer and use it in GitHub Desktop.

Resolve by module app-root-path

First, add bootstrap code like:

var appRootPath = require('app-root-path');
appRootPath.setPath(appRootPath.resolve('path/to/src/root'));
global.use = appRootPath.require;

And then use global function use like:

var TodoItem = use('components/todo-item');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment