<commit_before>import CaseSensitivePathsPlugin from "case-sensitive-paths-webpack-plugin";
import { CleanWebpackPlugin } from "clean-webpack-plugin";
import CopyPlugin from "copy-webpack-plugin";
import { InjectManifest } from "workbox-webpack-plugin";
import HtmlRendererWebpackPlugin from "html-renderer-webpack-plugin";
import path from "path";
import TerserPlugin from "terser-webpack-plugin";
import WatchExternalFilesPlugin from "webpack-watch-files-plugin";
import webpack, { Configuration } from "webpack";

import renderer from "./src/renderer";
import { routes } from "./src/routes";

const isProduction = process.env.NODE_ENV === "production";
const staticRoutes = [...Array.from(routes).map(route => route[0]), "/404"];

const config: Configuration = {
  target: "web",

  stats: isProduction ? "normal" : "minimal",

  mode: isProduction ? "production" : "development",

  devtool: isProduction ? "nosources-source-map" : "eval",

  resolve: {
    extensions: [".ts", ".js", ".tsx", ".jsx", ".jpg"]
  },

  entry: {
    client: path.resolve("./src/client.ts")
  },

  output: {
    chunkFilename: isProduction
      ? "static/[chunkhash:8].js"
      : "static/[name].[chunkhash:8].js",
    filename: isProduction ? "static/[hash:8].js" : "static/[name].[hash:8].js",
    path: path.resolve("./public"),
    publicPath: "/"
  },

  module: {
    rules: [
      {
        test: /\.(jsx?|tsx?)$/,
        exclude: /node_modules/,
        use: {
          loader: require.resolve("babel-loader"),
          options: {
            envName: "webpack"
          }
        }
      }
    ]
  },

  plugins: [
    new CleanWebpackPlugin(),
    new CaseSensitivePathsPlugin(),
    new webpack.HashedModuleIdsPlugin(),
    new webpack.DefinePlugin({
      "process.env": {
        NODE_ENV: JSON.stringify(isProduction ? "production" : "development")
      }
    }),
    new HtmlRendererWebpackPlugin({ paths: staticRoutes, renderer }),
    new CopyPlugin([{ from: "static/" }]),
    new InjectManifest({ swDest: "sw.js", swSrc: "./src/sw.ts" })
  ],<commit_msg>chore: use new config of HtmlRendererWebpackPlugin<commit_after>import CaseSensitivePathsPlugin from "case-sensitive-paths-webpack-plugin";
import { CleanWebpackPlugin } from "clean-webpack-plugin";
import CopyPlugin from "copy-webpack-plugin";
import { InjectManifest } from "workbox-webpack-plugin";
import HtmlRendererWebpackPlugin from "html-renderer-webpack-plugin";
import path from "path";
import TerserPlugin from "terser-webpack-plugin";
import WatchExternalFilesPlugin from "webpack-watch-files-plugin";
import webpack, { Configuration } from "webpack";

import { routes } from "./src/routes";

const isProduction = process.env.NODE_ENV === "production";
const staticRoutes = [...Array.from(routes).map(route => route[0]), "/404"];

const config: Configuration = {
  target: "web",

  stats: isProduction ? "normal" : "minimal",

  mode: isProduction ? "production" : "development",

  devtool: isProduction ? "nosources-source-map" : "eval",

  resolve: {
    extensions: [".ts", ".js", ".tsx", ".jsx", ".jpg"]
  },

  entry: {
    client: path.resolve("./src/client.ts")
  },

  output: {
    chunkFilename: isProduction
      ? "static/[chunkhash:8].js"
      : "static/[name].[chunkhash:8].js",
    filename: isProduction ? "static/[hash:8].js" : "static/[name].[hash:8].js",
    path: path.resolve("./public"),
    publicPath: "/"
  },

  module: {
    rules: [
      {
        test: /\.(jsx?|tsx?)$/,
        exclude: /node_modules/,
        use: {
          loader: require.resolve("babel-loader"),
          options: {
            envName: "webpack"
          }
        }
      }
    ]
  },

  plugins: [
    new CleanWebpackPlugin(),
    new CaseSensitivePathsPlugin(),
    new webpack.HashedModuleIdsPlugin(),
    new webpack.DefinePlugin({
      "process.env": {
        NODE_ENV: JSON.stringify(isProduction ? "production" : "development")
      }
    }),
    new HtmlRendererWebpackPlugin({
      paths: staticRoutes,
      renderer: "./src/renderer"
    }),
    new CopyPlugin([{ from: "static/" }]),
    new InjectManifest({ swDest: "sw.js", swSrc: "./src/sw.ts" })
  ],
{'fraction_non_alphanumeric': 0.16522366522366522, 'fraction_numerical': 0.003848003848003848, 'mean_word_length': 3.2395514780835883, 'pattern_counts': {'":': 2, '<': 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': '3578258', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1283, 'n_words': 270}