title: webpack use closure-webpack-plugin instead of google-closure-compiler
body: <p>Prior to webpack v4, <em>closure-webpack-plugin</em> support wasn't provided, so we had to use <em>google-closure-compiler</em>. I'm not sure how to use the plugin.</p>
  
  <p>File: buildSecondary.js</p>
  
  <pre><code>
  var ClosureCompiler = require('google-closure-compiler').compiler;
  
  function runClosueCompiler(){
      if(!flags.compile)
        return;
  
      console.log('Compiling');
  
      var fs = require('fs');
  
      var closureCompiler = new ClosureCompiler({
        js: 'folder/filename.js',
        compilation_level: 'ADVANCED'
      });
  
      var compilerProcess = closureCompiler.run(function(exitCode, stdOut, stdErr) {
        //compilation complete 
        if(exitCode === 0){
          console.log('successful');
          fs.writeFileSync('folder/filename.min.js', stdOut);
          console.log('compiled file in folder/filename.min.js');
        }else{
          console.log('complilation exited with code '+exitCode);
          console.error(stdErr);
        }
      });
      console.log('Closure compiler executed successfully');  
  }
  
  
  setTimeout(function () {
    console.log('appending module.exports into file/filename.js (import fix)');
    var fs = require('fs');
    var filedata = [
      fs.readFileSync(__dirname + '/file/filename.js').toString(),
      'if(typeof module !== "undefined")',
      'module.exports = filename;'
    ];
  
    //append to file export
    fs.writeFileSync(__dirname + '/file/filename.js', filedata.join('\n'));
  
    console.log('Executing closure compiler');
    runClosureCompiler();
  }, 2 * 100);
  </code></pre>
  
  <p>File: webpack.config.js</p>
  
  <pre><code>
  var Webpack = require('webpack');
  var path = require('path');
  const ClosurePlugin = require('closure-webpack-plugin');
  module.exports = {
  
      entry: './folder/entry_file.js',
  
      output: {
          path: path.join(__dirname, 'folder'),
          filename: 'filename.js',
      },
  
      module: {
          rules: [
              {
                  // Target Files
                  // test: /\.js?$/g,
  
                  // Excluded folders
                  exclude: /(node_modules|bower_components)/,
  
              },
          ]
      },
      optimization: {
          minimize: true,
          minimizer: [
              new ClosurePlugin({ mode: 'STANDARD'} , 
              { compilation_level: "ADVANCED" })
          ]
      },
      plugins: [
          new Webpack.LoaderOptionsPlugin({
              debug: true
          }),
  
  
      ],
  };  
  </code></pre>
  
  <p>I'm not sure as to what should be changed in the webpack.config.js to build a file similar to buildSecondary.js.</p>