{"size": 1080, "ext": "js", "max_stars_repo_path": "webpack.config.js", "max_stars_repo_name": "kad3nce/aws-appsync-js", "max_stars_repo_stars_event_min_datetime": "2018-01-30T18:54:02.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-23T00:34:20.000Z", "max_issues_repo_path": "webpack.config.js", "max_issues_repo_name": "kad3nce/aws-appsync-js", "max_issues_repo_issues_event_min_datetime": "2019-01-08T09:34:02.000Z", "max_issues_repo_issues_event_max_datetime": "2019-01-08T09:34:14.000Z", "max_forks_repo_path": "webpack.config.js", "max_forks_repo_name": "kad3nce/aws-appsync-js", "max_forks_repo_forks_event_min_datetime": "2018-08-20T14:25:59.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-15T00:49:28.000Z"}
{"max_stars_count": 23, "max_issues_count": 1, "max_forks_count": 3, "avg_line_length": 24.0, "max_line_length": 74, "alphanum_fraction": 0.612962963}
const webpack = require('webpack');

const webpackConfig = {
  context: __dirname,
  entry: { appsync: './src/index.js' },
  output: {
    path: `${__dirname}/dist`,
    filename: '[name].js',
    library: 'aws-appsync-js',
    libraryTarget: 'umd',
  },
  module: {
    rules: [
      { test: /\.js?$/, use: 'babel-loader', exclude: /node_modules/ },
    ],
  },
  plugins: [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(
        process.env.NODE_ENV || 'development',
      ),
    }),
    new webpack.ProvidePlugin({
      fetch: 'exports-loader?self.fetch!whatwg-fetch',
    }),
  ],
};

if (process.env.NODE_ENV === 'production') {
  const additionalPlugins = [
    new webpack.optimize.OccurrenceOrderPlugin(false),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false,
        drop_debugger: true,
        drop_console: true,
      },
    }),
  ];
  webpackConfig.plugins = webpackConfig.plugins.concat(additionalPlugins);
} else {
  webpackConfig.devtool = '#eval-source-map';
}

module.exports = webpackConfig;