{"size": 1151, "ext": "js", "max_stars_repo_path": "webpack.config.js", "max_stars_repo_name": "therealmikezinn/type-checker", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "webpack.config.js", "max_issues_repo_name": "therealmikezinn/type-checker", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "webpack.config.js", "max_forks_repo_name": "therealmikezinn/type-checker", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.868852459, "max_line_length": 83, "alphanum_fraction": 0.5343179844}
const webpack = require('webpack');

const config = {};

const { join } = require('path');

function generateConfig(name) {
  const uglify = name.indexOf('min') > -1;

  const config = {
    entry: './index.js',
    output: {
      path: __dirname + '/dist/',
      filename: name + '.js',
      sourceMapFilename: name + '.map',
      library: 'type',
      libraryTarget: 'umd',
    },
    node: {
      process: false,
    },
    devtool: 'source-map',
    module: {
      rules: [
        {
          test: /\.js$/,
          loader: 'babel-loader',
          exclude: /(node_modules|bower_components)/,
          include: join(__dirname, 'index.js'),

        },
      ],
    },
  };

  config.plugins = [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
    }),
  ];

  if (uglify) {
    config.plugins.push(
      new webpack.optimize.UglifyJsPlugin({
        compressor: {
          warnings: false,
        },
      }),
    );
  }

  return config;
}

['type-checker', 'type-checker.min'].forEach((key) => {
  config[key] = generateConfig(key);
});

module.exports = config;

