title: Webpack exclude 3rd party libraries installed via npm
body: <p>As for fun I am developing my own html/css admin panel theme migrating from old codebase into webpack as an attempt to make it more modular. Also I use it as an excuse for learning webpack and making my frontend code more test friendly.</p>
  
  <p>My webpack config is:</p>
  
  <pre><code>const path = require('path');
  
  module.exports = {
      entry: [
          __dirname+"/assets/js/panel.js",
      ],
      output: {
        path: __dirname+'/www',
        publicPath: '/',
        filename: 'panel.js'
      },
      module: {
        rules: [
          {
             test: /\.css$/,
             use: [
              'style-loader',
              'css-loader',
             ],
          },
          {
            test: /\.js$/,
            loader: 'babel-loader'
          },
          {
              test: /\.scss$/,
              use: [ 
                {
                  loader:'style-loader',
                },
                // Translates CSS into CommonJS
                {
                  loader:'css-loader'
                },
                // Compiles Sass to CSS
                {
                  loader:'sass-loader'
                },
              ],
          },
          {
              test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
              use: [
                { 
                  loader: 'file-loader',
                  options: {
                    name: '[name].[ext]',
                    outputPath: 'fonts/'
                 }
                }
              ]
          }
        ],
      },
      devServer: {
          contentBase: path.join(__dirname, 'www'),
          compress: true,
          port: 8000
      }
    };
  </code></pre>
  
  <p>And my <code>assets/js/panel.js</code> is considted of the following code:</p>
  
  <pre><code>
  // 3rd party libs
  import $ from 'jquery';
  import bsBreakpoints from 'bs-breakpoints'
  import 'bootstrap';
  import _ from 'lodash';
  import '@fortawesome/fontawesome-free/js/fontawesome'
  import '@fortawesome/fontawesome-free/js/solid' // https://fontawesome.com/icons?d=gallery&amp;s=solid&amp;m=free
  import '@fortawesome/fontawesome-free/js/regular' // https://fontawesome.com/icons?d=gallery&amp;s=regular&amp;m=free
  import '@fortawesome/fontawesome-free/js/brands' // https://fontawesome.com/icons?d=gallery&amp;s=brands&amp;m=free
  
  
  // Rest of the code is here
  </code></pre>
  
  <p>Also my <code>package.json</code> is consisted by this settings:</p>
  
  <pre><code>{
    "name": "ellakcy_admin",
    "version": "1.0.0",
    "description": "Admin HTML/CSS template using Bootstrap",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" &amp;&amp; exit 1",
      "build": "webpack",
      "start": "webpack-dev-server --compress"
    },
    "keywords": [
      "html",
      "css",
      "admin"
    ],
    "author": "Cypriot FOSS Community",
    "license": "GPL",
    "dependencies": {
      "@fortawesome/fontawesome-free": "^5.4.1",
      "bootstrap": "^4.3.1",
      "bs-breakpoints": "^1.0.0",
      "jquery": "^3.4.1",
      "jquery-ui-dist": "^1.12.1",
      "popper.js": "^1.16.0",
      "saas": "^1.0.0",
      "script-loader": "^0.7.2",
      "lodash": "&gt;=4.17.13",
      "lodash.template": "&gt;=4.5.0"
    },
    "devDependencies": {
      "@babel/core": "^7.7.2",
      "@babel/preset-env": "^7.7.1",
      "autoprefixer": "^9.7.1",
      "babel-loader": "^8.0.6",
      "css-loader": "^3.2.0",
      "file-loader": "^4.2.0",
      "node-sass": "^4.13.0",
      "sass-loader": "^8.0.0",
      "style-loader": "^1.0.0",
      "webpack": "^4.41.2",
      "webpack-cli": "^3.3.10",
      "webpack-dev-server": "^3.9.0",
      "clean-css": "&gt;=4.1.11"
    }
  }
  </code></pre>
  
  <p>So, many themes are being shipped without its 3rd party dependencies so when I build with the js and css with webpack how I can exclude them? I mean it is pointless to ship eg. fontawesome or bootstrap.</p>