'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _webpack = require('webpack');

var _webpack2 = _interopRequireDefault(_webpack);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const SharedCache = {};

function getConfig({ entryPoints, buildPath, buildSourceMaps, profiler = false }) {
  return {
    context: buildPath,
    profile: profiler,
    cache: SharedCache,
    entry: entryPoints,
    target: 'node',
    output: {
      path: buildPath,
      filename: '[name]',
      libraryTarget: 'commonjs2'
    },
    plugins: [new _webpack2.default.DefinePlugin({ 'global.GENTLY': false }), new _webpack2.default.LoaderOptionsPlugin({
      minimize: true,
      debug: false
    }), new _webpack2.default.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    }), new _webpack2.default.optimize.UglifyJsPlugin({
      debug: false,
      compress: {
        warnings: false
      },
      comments: false,
      sourceMap: buildSourceMaps
    })],
    devtool: buildSourceMaps ? 'source-map' : 'eval',
    resolveLoader: {
      alias: {
        'babel-loader': require.resolve('babel-loader')
      }
    },
    resolve: {
      unsafeCache: true
    },
    module: {
      exprContextCritical: false,
      rules: [{
        test: /\.js$/,
        exclude: /node_modules/,
        use: [{
          loader: 'babel-loader',
          query: {
            cacheDirectory: true,
            presets: [[require.resolve('babel-preset-es2015'), {
              modules: false,
              loose: true
            }]],
            plugins: [require.resolve('babel-plugin-syntax-async-functions'), require.resolve('babel-plugin-syntax-object-rest-spread'), require.resolve('babel-plugin-transform-object-rest-spread'), require.resolve('babel-plugin-transform-class-properties'), require.resolve('babel-plugin-transform-regenerator'), require.resolve('babel-plugin-transform-export-extensions'), require.resolve('babel-plugin-transform-decorators-legacy'), require.resolve('babel-plugin-transform-async-to-generator'), require.resolve('babel-plugin-transform-runtime')]
          }
        }]
      }]
    }
  };
}

exports.default = getConfig;
module.exports = exports['default'];
//# sourceMappingURL=webpack-config.js.map