<commit_before>const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const failPlugin = require('webpack-fail-plugin');
const DashboardPlugin = require('webpack-dashboard/plugin');
const merge = require('webpack-merge');
const CleanWebpackPlugin = require('clean-webpack-plugin');

const TARGET = process.env.npm_lifecycle_event;

const common = {
  entry: {
    app: './src/index',
    vendor: [
      'inferno',
      'inferno-component',
      'inferno-redux',
      'inferno-router',
      'redux',
      'purecss',
    ],
  },
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: '[chunkhash].[name].js',
  },
  resolve: {
    extensions: ['.js', '.jsx', '.json'],
  },
  module: {
    rules: [{
      test: /\.jsx?$/,
      loader: 'babel-loader',
    }, {
      test: /\.handlebars$/,
      loader: 'handlebars-loader',
      options: {
        inlineRequires: '\/img\/',
      },
    }, {
      test: /\.css$/,
      use: [
        { loader: 'style-loader' },
        { loader: 'css-loader' },
      ],
    }, {
      test: /\.scss$/,
      use: [
        { loader: 'style-loader' },
        { loader: 'css-loader' },
        { loader: 'sass-loader' },
      ],
    }],
  },
  plugins: [
    new CleanWebpackPlugin(['build']),
    new HtmlWebpackPlugin({
      template: './src/index.html.handlebars',
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: ['vendor', 'manifest'],
    }),
    new webpack.optimize.OccurrenceOrderPlugin(),
    failPlugin,
  ],
  devtool: 'inline-source-map',
  devServer: {
    inline: true,
    historyApiFallback: true,
  },
};

if (TARGET === 'build') {
  module.exports = common;
} else if (TARGET === 'serve') {
  module.exports = merge(common, {
    plugins: [
      new DashboardPlugin(),
    ],
  });
}<commit_msg>Production ready build<commit_after>const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const failPlugin = require('webpack-fail-plugin');
const DashboardPlugin = require('webpack-dashboard/plugin');
const merge = require('webpack-merge');
const CleanWebpackPlugin = require('clean-webpack-plugin');

const common = {
  entry: {
    app: './src/index',
    vendor: [
      'inferno',
      'inferno-component',
      'inferno-redux',
      'inferno-router',
      'redux',
      'purecss',
    ],
  },
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: '[chunkhash].[name].js',
  },
  resolve: {
    extensions: ['.js', '.jsx', '.json'],
  },
  module: {
    rules: [{
      test: /\.jsx?$/,
      loader: 'babel-loader',
    }, {
      test: /\.handlebars$/,
      loader: 'handlebars-loader',
      options: {
        inlineRequires: '\/img\/',
      },
    }, {
      test: /\.css$/,
      use: [
        { loader: 'style-loader' },
        { loader: 'css-loader' },
      ],
    }, {
      test: /\.scss$/,
      use: [
        { loader: 'style-loader' },
        { loader: 'css-loader' },
        { loader: 'sass-loader' },
      ],
    }],
  },
  plugins: [
    new CleanWebpackPlugin(['build']),
    new HtmlWebpackPlugin({
      template: './src/index.html.handlebars',
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: ['vendor', 'manifest'],
    }),
    new webpack.optimize.OccurrenceOrderPlugin(),
    failPlugin,
  ],
  devtool: 'inline-source-map',
  devServer: {
    inline: true,
    historyApiFallback: true,
  },
};

switch (process.env.npm_lifecycle_event) {
  case 'serve':
    module.exports = merge(common, {
      plugins: [
        new DashboardPlugin(),
      ],
    });
    break;
  case 'build':
    module.exports = merge(common, {
      plugins: [
        new HtmlWebpackPlugin({
          template: './src/index.html.handlebars',
          minify: {
            collapseWhitespace: true,
            collapseInlineTagWhitespace: true,
          },
        }),
        new webpack.optimize.UglifyJsPlugin({
          compress: {
            warnings: true,
          },
          output: {
            comments: false,
          },
          sourceMap: false,
        }),
        new webpack.LoaderOptionsPlugin({
          minimize: true,
          debug: false,
        }),
        new webpack.DefinePlugin({
          'process.env': {
            NODE_ENV: JSON.stringify('production'),
          },
        }),
      ],
    });
    break;
  default:
    module.exports = common;
}
{'fraction_non_alphanumeric': 0.17317563043963402, 'fraction_numerical': 0.0, 'mean_word_length': 2.1652542372881354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4847783', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1414, 'n_words': 258}