title: Should we use pre-bundled javascript file in WordPress project?
body: <p>Recently I tried to use module system like requirejs/browserify/webpack for my wordpress project, the main purpose is bundle assets(javascript, css files etc).</p>
  
  <p>But there is a problem I'm confusing: Should we use pre-bundled javascript file in WordPress theme/plugin project?</p>
  
  <p>The Pros of pre-bundled script is reduce requests and improve performance, so why this is a problem?</p>
  
  <p>Because usually a wordpress website is not just use one theme but many plugins. If a wordpress module(theme/plugin) used pre-bundled scripts, it may results that same script loaded by different modules and users have no choice to dequeue it.</p>
  
  <p>For example:</p>
  
  <h3>pre-bundle</h3>
  
  <p>my theme <code>A</code> use a pre-bundled scripts file <code>bundle.js</code> which included lodash, backbone, jquery, carousel plugin, bootstrap..., a user used my theme on their site, and activated many plugins, some of plugins enqueued backbone, bootstrap or other same plugins. Even we can resolve conflict problem, the site will load same library/plugins many times to result unnecessary extra load time of page. </p>
  
  <h3>post-bundle</h3>
  
  <p>if we use WordPress way <code>wp_enqueue_script()</code> and <code>wp_enqueue_style()</code> to load script separately and implement assets dependecies. The users can dequeue script with <code>wp_dequeue_script()</code> when there is same script used in different modules, and users can use some minfiy/merge plugin to merge all scripts, which I called post-bundle.</p>
  
  <p>So, question again, Should we use pre-bundled javascript file in WordPress project? or do you have a suggestion for what is best way to organize scripts in WordPress project? </p>