I cannot figure out how the browserify basedir option works..
Note: I may be wrong in my understanding of the whole basedir concept because I\'m co
It turns out that basedir is not the same as RequireJS's baseUrl. As stated by @Ben in the comment above, the official docs says:
opts.basediris the directory that browserify starts bundling from for filenames that start with..
(source)
Meaning that basedir only applies to the entry files. Further require calls deep in the file tree structure will always be resolved relatively to the file currently being parsed.
The paths option of browser-resolve (which is used by browserify under the hood) is what I was looking for:
paths - require.paths array to use if nothing is found on the normal node_modules recursive walk
(source)
Just pass this option along with other browserify options when instantiating the bundler.
Note: It looks like it is messing up things when using together with browserify-shim transform.