<commit_before>import { CleanWebpackPlugin } from 'clean-webpack-plugin'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import dotenv from 'dotenv'
import HtmlWebpackMultiBuildPlugin from 'html-webpack-multi-build-plugin'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import path from 'path'
import SVGSpritemapPlugin from 'svg-spritemap-webpack-plugin'
import { Configuration, DefinePlugin } from 'webpack'

// Some dependencies are written in ES2015+ syntax and will need to be included explicitly.
// Adding them to this config will transpile and add polyfills to the code if necessary.
const modernModules = [
  path.resolve(__dirname, 'node_modules/@datapunt/asc-assets'),
  path.resolve(__dirname, 'node_modules/@datapunt/asc-ui'),
  path.resolve(__dirname, 'node_modules/body-scroll-lock'),
  path.resolve(__dirname, 'node_modules/escape-string-regexp'),
]

const env = dotenv.config().parsed ?? {}
const envKeys = Object.entries(env).reduce((prev, [key, value]) => {
  prev[`process.env.${key}`] = JSON.stringify(value)
  return prev
}, {} as { [key: string]: string })

export interface CreateConfigOptions {
  /**
   * If enabled a build optimized for legacy browsers with ES5 code and various polyfills will be created,
   * otherwise a more modern build using ES2015 syntax will be used with less polyfills.
   */
  legacy: boolean
  /**
   * Enable production optimizations or development hints.
   */
  mode: Configuration['mode']<commit_msg>Add redux-first-router to list of ESM dependencies<commit_after>import { CleanWebpackPlugin } from 'clean-webpack-plugin'
import CopyWebpackPlugin from 'copy-webpack-plugin'
import dotenv from 'dotenv'
import HtmlWebpackMultiBuildPlugin from 'html-webpack-multi-build-plugin'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import path from 'path'
import SVGSpritemapPlugin from 'svg-spritemap-webpack-plugin'
import { Configuration, DefinePlugin } from 'webpack'

// Some dependencies are written in ES2015+ syntax and will need to be included explicitly.
// Adding them to this config will transpile and add polyfills to the code if necessary.
const modernModules = [
  '@datapunt/asc-assets',
  '@datapunt/asc-ui',
  'body-scroll-lock',
  'escape-string-regexp',
  'redux-first-router',
].map((entry) => `${path.resolve(__dirname, 'node_modules', entry)}/`)

const env = dotenv.config().parsed ?? {}
const envKeys = Object.entries(env).reduce((prev, [key, value]) => {
  prev[`process.env.${key}`] = JSON.stringify(value)
  return prev
}, {} as { [key: string]: string })

export interface CreateConfigOptions {
  /**
   * If enabled a build optimized for legacy browsers with ES5 code and various polyfills will be created,
   * otherwise a more modern build using ES2015 syntax will be used with less polyfills.
   */
  legacy: boolean
  /**
   * Enable production optimizations or development hints.
   */
  mode: Configuration['mode']
{'fraction_non_alphanumeric': 0.11122112211221122, 'fraction_numerical': 0.005940594059405941, 'mean_word_length': 4.908382066276803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '186183', 'n_tokens_mistral': 886, 'n_tokens_neox': 870, 'n_words': 278}