title: requireJS configuration for Modernizr
body: <p>I am trying to load the <strong>Modernizr</strong> feature detects dynamically with <strong>requireJS</strong>.<br>
  As Modernizr has built in <em>AMD</em> support this shouldn't be a problem.  </p>
  
  <p>My requireJS configuration contains the paths to the Modernizr source directory and to the feature detects directory:</p>
  
  <pre><code>requirejs.config({
    paths: {
      "modernizr" : "components/modernizr/src",
      "feature-detects": "components/modernizr/feature-detects"
    }
  });
  </code></pre>
  
  <p>Lets assume one of my views would require the <em>svg</em> test.<br>
  My view definition might look like <a href="https://github.com/jantimon/requirejs-modernizr/blob/master/app.js">this</a></p>
  
  <pre><code>define(["feature-detects/svg"], function() { .. });
  </code></pre>
  
  <p>Unfortunately the <code>svg.js</code> can't find <code>Modernizr.js</code> because all feature detects and Modernizr source files load Modernizr without specifying any directory: <code>define(['Modernizr'], ..</code>.</p>
  
  <p>Which results in a very ugly <strong><a href="https://github.com/jantimon/requirejs-modernizr/blob/master/build/require.config.js">require.config</a></strong></p>
  
  <pre><code>requirejs.config({
    paths: {
      "Modernizr": "components/modernizr/src/Modernizr",
      "addTest": "components/modernizr/src/addTest",
      "ModernizrProto": "components/modernizr/src/ModernizrProto",
      "setClasses": "components/modernizr/src/setClasses",
      "hasOwnProp": "components/modernizr/src/hasOwnProp",
      "tests": "components/modernizr/src/tests",
      "is": "components/modernizr/src/is",
      "docElement": "components/modernizr/src/docElement",
      "feature-detects": "components/modernizr/feature-detects"
    }
  });
  </code></pre>
  
  <p>Is there a cleaner way to tell requireJS to search in <code>components/modernizr/src/</code> whenever it couldn't find the file?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I created an <a href="https://github.com/jantimon/requirejs-modernizr">example github project</a> which includes the basic setup and a running <a href="http://jantimon.github.io/requirejs-modernizr/">demonstration</a>.</p>