Categories
browserify commonjs javascript node.js requirejs

Get browserify require paths to behave more like requirejs

I’m finding that it’s a pain when moving files around and constantly having to rewrite the file include paths to be relative to their new folder.

I want to avoid this in my browserify code:

var View = require('../../../../base/view');

And do something more in line with requirejs where it knows my base path is js:

var View = require('base/view');