title: How to avoid same modules duplication Webpack bundling?
body: <p>I use laravel-mix (including webpack) to bundle JS files.
  Using BundleAnalyzerPlugin I found that my output file includes more than one copy of JQuery lib which boosts the output file size.</p>
  
  <p>It seams several modules includes JQuery by themselves. </p>
  
  <p>Any ideas how to avoid this and remove all redundant jquery inclusions? </p>
  
  <p>(UPDATED with more info)</p>
  
  <p><a href="https://i.stack.imgur.com/CGEz4.jpg" rel="nofollow noreferrer">Image of Bundle analyzer output</a></p>
  
  <p><strong>webpack.mix.js</strong></p>
  
  <pre><code>const { mix } = require('laravel-mix');
  const webpack = require('webpack');
  
  const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
  
  mix.js('resources/assets/js/admin.js', 'public/js')
  
  mix.webpackConfig({
      plugins: [
          new BundleAnalyzerPlugin(),
          new webpack.ProvidePlugin({ // Added as a suggestion. Makes no difference
              '$': 'jquery',
              'jQuery': 'jquery',
              'window.jQuery': 'jquery'
          })
      ],
  });
  </code></pre>
  
  <p><strong>admin.js</strong></p>
  
  <pre><code>import 'jquery'
  import 'toastr'
  </code></pre>