title: Browserify basedir option (RequireJS-like)
body: <p>I cannot figure out how the <a href="https://github.com/substack/node-browserify#var-b--browserifyfiles-or-opts" rel="nofollow noreferrer">browserify <code>basedir</code> option</a> works..</p>
  
  <p><em>Note</em>: I may be wrong in my understanding of the whole <code>basedir</code> concept because I'm coming from RequireJS (think <code>baseUrl</code>).</p>
  
  <p><strong>EDIT</strong>
  Indeed I was wrong, but you can still achieve what I was trying to do with the <code>paths</code> option, see my answer below.</p>
  
  <p>I understand that the <code>basedir</code> option gives you the ability (the freedom!) to specify all require paths (starting with a <code>.</code>) from a static root/base dir.. And NOT from <code>process.cwd()</code>..</p>
  
  <p>This is literally driving me crazy, I though such a feature would be so basic to implement and that a lot of people would have run into the same issue as me, but there is actually very few info on the web about how to setup properly the <code>basedir</code> option.. And trust me, this is not straight-forward..</p>
  
  <p>So here is the BASIC example that's driving me crazy.</p>
  
  <p>Given the following file structure:</p>
  
  <pre><code>js/
  js/app.js
  js/src/models/Person.js
  js/src/views/PersonView.js
  </code></pre>
  
  <p>And running:</p>
  
  <pre><code>var browserify = require('browserify');
  var gulp = require('gulp');
  
  gulp.task('scripts', function() {
  
    var b = browserify('./app', {basedir: './js'});
  
    b.bundle().pipe(gulp.dest('./dist'));
  });
  </code></pre>
  
  <p>I would expect being able to do the following <code>require()</code> call in <code>PersonView.js</code>:</p>
  
  <pre><code>var Person = require('./src/models/Person');
  ...
  </code></pre>
  
  <p>Instead of (which is obviously working...):</p>
  
  <pre><code>var Person = require('../models/Person');
  ...
  </code></pre>
  
  <p>But I get the following error:</p>
  
  <pre><code>Error: module "./src/models/Person" not found from "/Users/...some path.../js/src/views/PersonView.js"
  </code></pre>
  
  <p>What am I missing about the <code>basedir</code> option?</p>