As stated in the documentation, Browserify uses browser-resolve
under the hood.
When using the node API (as opposed to the CLI), you can specify a paths
option which contains a list of directories to pass to browser-resolve
.
The solution for my example would thus be something like this:
var browserify = require('browserify');
var b = browserify({
paths: [
__dirname + '/src'
]
});
b.add(__dirname + '/src/AAA.js');
b.bundle().pipe(process.stdout);