<commit_before>import path from 'path';
import AssetsPlugin from 'assets-webpack-plugin';
import webpack from 'webpack';

import config from './config';

const isProduction = config.env === 'production';

export default {
  entry: isProduction ? [
    './index.js',
  ] : [
    'webpack-hot-middleware/client',
    'react-hot-loader/patch',
    './index.js',
  ],
  context: path.resolve(__dirname, './client'),
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: `[name]${isProduction ? '.[chunkhash:8]' : ''}.js`,
    publicPath: '/',
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: !isProduction,
            },
          },
        ],
      },
      {
        test: /\.(eot|gif|jpe?g|otf|png|svg|webp|woff|woff2?|ttf)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: '[name].[hash:8].[ext]',
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new AssetsPlugin({
      filename: 'assets.json',
      path: 'build',
    }),
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      },
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: isProduction,
    }),
    ...isProduction ? [
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          warnings: false,
        },
        output: {
          comments: false,
        },
      }),
    ] : [
      new webpack.HotModuleReplacementPlugin(),
    ],
  ],
  resolve: {
    alias: {
      'styled-components$': 'styled-components/lib/index.js',
    },
  },
  bail: isProduction,
  cache: !isProduction,
  stats: {
    children: false,
  },
};<commit_msg>Add NamedModulesPlugin<commit_after>import path from 'path';
import AssetsPlugin from 'assets-webpack-plugin';
import webpack from 'webpack';

import config from './config';

const isProduction = config.env === 'production';

export default {
  entry: isProduction ? [
    './index.js',
  ] : [
    'webpack-hot-middleware/client',
    'react-hot-loader/patch',
    './index.js',
  ],
  context: path.resolve(__dirname, './client'),
  output: {
    path: path.resolve(__dirname, 'build'),
    filename: `[name]${isProduction ? '.[chunkhash:8]' : ''}.js`,
    publicPath: '/',
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              cacheDirectory: !isProduction,
            },
          },
        ],
      },
      {
        test: /\.(eot|gif|jpe?g|otf|png|svg|webp|woff|woff2?|ttf)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: 10000,
              name: '[name].[hash:8].[ext]',
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new AssetsPlugin({
      filename: 'assets.json',
      path: 'build',
    }),
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      },
    }),
    new webpack.LoaderOptionsPlugin({
      minimize: isProduction,
    }),
    ...isProduction ? [
      new webpack.optimize.UglifyJsPlugin({
        compress: {
          warnings: false,
        },
        output: {
          comments: false,
        },
      }),
    ] : [
      new webpack.NamedModulesPlugin(),
      new webpack.HotModuleReplacementPlugin(),
    ],
  ],
  resolve: {
    alias: {
      'styled-components$': 'styled-components/lib/index.js',
    },
  },
  bail: isProduction,
  cache: !isProduction,
  stats: {
    children: false,
  },
};
{'fraction_non_alphanumeric': 0.16516129032258065, 'fraction_numerical': 0.004129032258064516, 'mean_word_length': 1.7745168217609162, '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': '203837', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1224, 'n_words': 207}