title: How to include minified library version in RequireJS optimization
body: <p>My situation is as follows:</p>
  
  <ul>
  <li>My project based on RequireJS.</li>
  <li>I am using RequireJS Optimizer for to create a single JS file.</li>
  <li>Some of the module use a certain third party library as a dependency.</li>
  <li>The third party is NOT included in the optimized file (libName: empty
  in the build config).</li>
  <li>RequireJS is configured through var require = {} object which appears
  on EACH PAGE, right above the RequireJS. The object defines a path to
  the unminifed version of the library, among other things.</li>
  </ul>
  
  <p>What i'd like to achieve:
  Use the same config file in both development and production (the require={} object is included with  tag on each page). During development I'd like modules to use the UNMINIFIED version of the third party.However, after optimization occurs, i would like all the modules to use the minified version of that third party.</p>
  
  <p>I did think of a solution in theory, but it seems a bit messy and Im hopeful cleaner solution exists:</p>
  
  <p>To have the runtime config point to unminified version</p>
  
  <pre><code>var require = {
   paths:{
     'thirdParty':'lib/thirdParty'
  }
  }
  </code></pre>
  
  <p>Create a module which execute (lets call it "PathRewrite" Module):</p>
  
  <pre><code>requirejs.config({
   paths:{
     'thirdParty':'lib/thirdParty.min'
  }
  })
  </code></pre>
  
  <p>In runtime configuration, define path to "PathRewrite" as empty</p>
  
  <pre><code>var require = {
   paths:{
     'thirdParty':'lib/thirdParty',
     'PathRewrite':'empty'
  }
  }
  </code></pre>
  
  <p>In the build configuration file define a real Path to "PathRewrite" in order for it to be included in the "main" file (concatenated file after build).</p>
  
  <p>Include "PathRewrite" as a dependency of a module which is executed first.</p>
  
  <p>What I hope that will happen is that during dev, when optimized file is not used, PathRewrite is will not be used, hence the path to unminified third party in the runtime config will be used.
  When the project is optimized, PathRewrite will be included and executed. According to RequireJS documentation, it is possible to run RequireJS configuration twice and the configuration will be appended/overwritten. PathRewrite execution will overwrite the path to "thirdParty" to minified, which will thus be used by all the modules. </p>
  
  <p>Hopefully i've provided enough information. I'd be glad hear of other ways to get this done. Thanks in advance.</p>