<commit_before>const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyPlugin = require('uglifyjs-webpack-plugin');

const config = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(process.cwd(), './lib'),
  },
  module: {
    noParse: /node_modules/,
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              extends: path.resolve(__dirname, 'babel.json5'),
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new CleanWebpackPlugin(['./lib'], {
      root: process.cwd(),
    }),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
    }),
  ],
  devtool: 'cheap-source-map',
  target: 'web',
};

if (process.env.NODE_ENV === 'production') {
  config.devtool = 'source-map';
  config.plugins.push(
    new UglifyPlugin({
      parallel: true,
      sourceMap: true,
    }),
  );
}

module.exports = config;<commit_msg>Improved webpack config.<commit_after>/* eslint-disable no-magic-numbers */

const path = require('path');
const webpack = require('webpack');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const UglifyPlugin = require('uglifyjs-webpack-plugin');
const options = require('yargs-parser')(process.argv.slice(2));

// Webpack requires the inputs and output passed as CLI arguments,
// so make sure they are passed instead of configured here.
const inputs = [...options._];
const output = inputs.pop();

if (inputs.length === 0 || !output) {
  throw new Error('Webpack input and output arguments required.');
}

const config = {
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: 'babel-loader',
            options: {
              extends: path.resolve(__dirname, 'babel.json5'),
            },
          },
        ],
      },
    ],
  },
  plugins: [
    new webpack.EnvironmentPlugin(['NODE_ENV']),
  ],
  devtool: 'cheap-source-map',
  target: 'web',
};

if (options.clean) {
  config.plugins.push(
    new CleanWebpackPlugin([path.dirname(output)], {
      root: process.cwd(),
    }),
  );
}

if (process.env.NODE_ENV === 'production') {
  config.devtool = 'source-map';
  config.plugins.push(
    new UglifyPlugin({
      parallel: true,
      sourceMap: true,
    }),
  );
}

module.exports = config;
{'fraction_non_alphanumeric': 0.16502560063016936, 'fraction_numerical': 0.0015754233950374162, 'mean_word_length': 2.4746922024623803, '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': '1239623', 'n_tokens_mistral': 807, 'n_tokens_neox': 796, 'n_words': 164}