title: How to avoid code duplication using Browserify
body: <p>CommonJS noob here, I read about browserify and thought it was simpler than my existing RequireJS setup, so I went ahead and changed them. What I have found out is I am going to have code duplication in each bundle. Let me explain:</p>
  
  <p>Lets say, I have <code>page1.js</code> and <code>page2.js</code> make use of <code>jquery.js</code> and <code>jquery-ui.js</code></p>
  
  <p>Now I have to create <code>bundle1.js</code> and <code>bundle2.js</code> and the content of <code>jquery.js</code> and <code>jquery-ui.js</code> is duplicated in each bundle.</p>
  
  <p>I have tried separated into different files in browser by only bundling the <code>jquery.js</code> and <code>jquery-ui.js</code> such as:</p>
  
  <pre><code>&lt;script src="lib_bundle.js"&gt;
  &lt;script src="page1.js"&gt;
  </code></pre>
  
  <p>Problem is that the <code>require</code> within <code>page1.js</code> will fail because it's not a commonjs bundle.</p>