<commit_before>const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const isProduction = process.env.NODE_ENV === 'production';
const htmlWebpackPlugin = new HtmlWebpackPlugin({
  template: 'index.html',
  inject: true,
  production: isProduction,
  minify: isProduction && {
    removeComments: true,
    collapseWhitespace: true,
    removeRedundantAttributes: true,
    useShortDoctype: true,
    removeEmptyAttributes: true,
    removeStyleLinkTypeAttributes: true,
    keepClosingSlash: true,
    minifyJS: true,
    minifyCSS: true,
    minifyURLs: true,
  },
});

module.exports = {
  context: path.resolve(__dirname, 'src', 'client'),
  devtool: 'source-map',
  target: 'web',
  entry: isProduction
    ? ['./app.production.js']
    : ['webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000', 'react-hot-loader/patch', './app.js'],
  output: {
    path: path.resolve(__dirname, './build'),
    publicPath: '/',
    filename: isProduction ? '[name].js' : 'app.bundle.js',
    chunkFilename: '[id].[chunkhash].js',
  },
  resolve: {
    extensions: ['.js', '.json', '.css', '.svg'],
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
      },
      isProduction
        ? null
        : {
          test: /\.html$/,
          loader: 'file-loader?name=[name].[ext]',
        },
      {
        test: /\.(jpg|png|svg)$/,
        loader: 'file-loader', // or 'url'
      },
      {
        test: /\.css$/,
        use: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              modules: true,
              sourceMap: true,
              importLoaders: 1,
              localIdentName: '[name]--[local]--[hash:base64:8]',
            },
          },
          'postcss-loader', // has separate config, see postcss.config.js nearby
        ],
      },
    ].filter(x => x),
  },
  plugins: isProduction
    ? [
      new webpack.DefinePlugin({
        'process.env.SHARED_DASHBOARD': !!process.env.SHARED_DASHBOARD || '',
      }),
      new webpack.LoaderOptionsPlugin({
        minimize: true,
        debug: false,
      }),
      new webpack.optimize.UglifyJsPlugin({
        sourceMap: true,
        compress: {
          warnings: false,
        },
        mangle: true,
        beautify: false, // use true for debugging
      }),
      htmlWebpackPlugin,
    ]
    : [
      new webpack.NamedModulesPlugin(),
      new webpack.DefinePlugin({
        'process.env.SHARED_DASHBOARD': !!process.env.SHARED_DASHBOARD || '',
      }),
      new webpack.HotModuleReplacementPlugin(),
    ],
};
<commit_msg>using a hash in an output file name<commit_after>const webpack = require('webpack');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const isProduction = process.env.NODE_ENV === 'production';
const htmlWebpackPlugin = new HtmlWebpackPlugin({
  template: 'index.html',
  inject: true,
  production: isProduction,
  minify: isProduction && {
    removeComments: true,
    collapseWhitespace: true,
    removeRedundantAttributes: true,
    useShortDoctype: true,
    removeEmptyAttributes: true,
    removeStyleLinkTypeAttributes: true,
    keepClosingSlash: true,
    minifyJS: true,
    minifyCSS: true,
    minifyURLs: true,
  },
});

module.exports = {
  context: path.resolve(__dirname, 'src', 'client'),
  devtool: 'source-map',
  target: 'web',
  entry: isProduction
    ? ['./app.production.js']
    : ['webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000', 'react-hot-loader/patch', './app.js'],
  output: {
    path: path.resolve(__dirname, './build'),
    publicPath: '/',
    filename: isProduction ? '[name]-[hash].js' : 'app.bundle.js',
    chunkFilename: '[id].[chunkhash].js',
  },
  resolve: {
    extensions: ['.js', '.json', '.css', '.svg'],
  },
  module: {
    loaders: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
      },
      isProduction
        ? null
        : {
          test: /\.html$/,
          loader: 'file-loader?name=[name].[ext]',
        },
      {
        test: /\.(jpg|png|svg)$/,
        loader: 'file-loader', // or 'url'
      },
      {
        test: /\.css$/,
        use: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              modules: true,
              sourceMap: true,
              importLoaders: 1,
              localIdentName: '[name]--[local]--[hash:base64:8]',
            },
          },
          'postcss-loader', // has separate config, see postcss.config.js nearby
        ],
      },
    ].filter(x => x),
  },
  plugins: isProduction
    ? [
      new webpack.DefinePlugin({
        'process.env.SHARED_DASHBOARD': !!process.env.SHARED_DASHBOARD || '',
      }),
      new webpack.LoaderOptionsPlugin({
        minimize: true,
        debug: false,
      }),
      new webpack.optimize.UglifyJsPlugin({
        sourceMap: true,
        compress: {
          warnings: false,
        },
        mangle: true,
        beautify: false, // use true for debugging
      }),
      htmlWebpackPlugin,
    ]
    : [
      new webpack.NamedModulesPlugin(),
      new webpack.DefinePlugin({
        'process.env.SHARED_DASHBOARD': !!process.env.SHARED_DASHBOARD || '',
      }),
      new webpack.HotModuleReplacementPlugin(),
    ],
};

{'fraction_non_alphanumeric': 0.15683768486397662, 'fraction_numerical': 0.0032864706956362974, 'mean_word_length': 2.1609924985574147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7522923', 'n_tokens_mistral': 1758, 'n_tokens_neox': 1712, 'n_words': 321}