// This script builds a production output of all of our bundles.

import webpack from 'webpack';
import appRootDir from 'app-root-dir';
import { resolve as pathResolve } from 'path';
import webpackConfigFactory from '../webpack/configFactory';
import { exec } from '../utils';
import getConfig from '../../config/get';

// First clear the build output dir.
// exec(`rimraf ${pathResolve(appRootDir.get(), getConfig('buildOutputPath'))}`);
// REMOVED, we do this in build script

// Get our "fixed" bundle names
Object.keys(getConfig('bundles'))
// And the "additional" bundle names
.concat(Object.keys(getConfig('additionalNodeBundles')))
// And then build them all.
.forEach((bundleName) => {
  const compiler = webpack(
    webpackConfigFactory({ target: bundleName }),
  );
  compiler.run((err, stats) => {
    if (err) {
      console.error(err);
      return;
    }
    console.log(stats.toString({ colors: true }));
  });
});

@@ -94,94 +94,8 @@
 k';%0A
-import appRootDir from 'app-root-dir';%0Aimport %7B resolve as pathResolve %7D from 'path';%0A
 impo
@@ -155,41 +155,8 @@
 y';%0A
-import %7B exec %7D from '../utils';%0A
 impo

Remove unused imports in build.js