<commit_before>const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin')
const HtmlPlugin = require('html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
const webpack = require('webpack')

const isProd = process.env.NODE_ENV === 'production'

const config = {
  context: __dirname,
  mode: 'development',
  devtool: 'source-map',

  devServer: {
    disableHostCheck: true,
    host: '0.0.0.0',
    port: 8080,
  },

  entry: {
    app: './src/index.tsx',
  },

  output: {
    filename: '[name].js',
    path: `${__dirname}/dist`,
  },

  module: {
    rules: [
      {
        enforce: 'pre',
        test: /\.tsx?/,
        exclude: /node_modules/,
        loader: 'eslint-loader',
      },

      {
        test: /\.pug/,
        exclude: /node_modules/,
        loader: 'pug-loader',
      },

      {
        test: /\.tsx?/,
        exclude: /node_modules/,
        loader: 'ts-loader',
        options: {
          transpileOnly: true,
        },
      },
    ],
  },

  resolve: {
    extensions: ['.js', '.json', '.ts', '.tsx'],

    plugins: [
      new TsConfigPathsPlugin(),
    ],
  },

  plugins: [
    new HtmlPlugin({
      template: './src/index.pug',
    }),

    new ForkTsCheckerPlugin({
      eslint: true,
    }),

    new webpack.EnvironmentPlugin({
      NODE_ENV: 'development',
      GA_TRACKING_ID: '',
    }),
  ],
}

if (isProd) {
  config.mode = 'development'
  config.devtool = false
  config.output.filename = '[name].[contenthash].js'
  config.optimization = {
    minimize: true,
    minimizer: [new TerserPlugin()],
    splitChunks: {
      chunks: 'all',
    },
  }
}

module.exports = config<commit_msg>change mode to production if isProd is true<commit_after>const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin')
const HtmlPlugin = require('html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const TsConfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
const webpack = require('webpack')

const isProd = process.env.NODE_ENV === 'production'

const config = {
  context: __dirname,
  mode: 'development',
  devtool: 'source-map',

  devServer: {
    disableHostCheck: true,
    host: '0.0.0.0',
    port: 8080,
  },

  entry: {
    app: './src/index.tsx',
  },

  output: {
    filename: '[name].js',
    path: `${__dirname}/dist`,
  },

  module: {
    rules: [
      {
        enforce: 'pre',
        test: /\.tsx?/,
        exclude: /node_modules/,
        loader: 'eslint-loader',
      },

      {
        test: /\.pug/,
        exclude: /node_modules/,
        loader: 'pug-loader',
      },

      {
        test: /\.tsx?/,
        exclude: /node_modules/,
        loader: 'ts-loader',
        options: {
          transpileOnly: true,
        },
      },
    ],
  },

  resolve: {
    extensions: ['.js', '.json', '.ts', '.tsx'],

    plugins: [
      new TsConfigPathsPlugin(),
    ],
  },

  plugins: [
    new HtmlPlugin({
      template: './src/index.pug',
    }),

    new ForkTsCheckerPlugin({
      eslint: true,
    }),

    new webpack.EnvironmentPlugin({
      NODE_ENV: 'development',
      GA_TRACKING_ID: '',
    }),
  ],
}

if (isProd) {
  config.mode = 'production'
  config.devtool = false
  config.output.filename = '[name].[contenthash].js'
  config.optimization = {
    minimize: true,
    minimizer: [new TerserPlugin()],
    splitChunks: {
      chunks: 'all',
    },
  }
}

module.exports = config
{'fraction_non_alphanumeric': 0.16595623756749076, 'fraction_numerical': 0.004546746234725774, 'mean_word_length': 2.2653061224489797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3902434', 'n_tokens_mistral': 1225, 'n_tokens_neox': 1187, 'n_words': 224}