<commit_before>/* eslint-disable global-require,import/no-dynamic-require */
const _ = require('lodash'),
  assert = require('assert'),
  json = JSON.stringify,
  path = require('path'),
  webpack = require('webpack'),
  ExtractTextPlugin = require('extract-text-webpack-plugin'),
  HtmlWebpackPlugin = require('html-webpack-plugin')
  ;

const VERSIONED_DIR = '__ver__';

module.exports = function genDevConfig(pageDef, srcRoot, outputRoot,
  configSpec, entryPoints, pageDataLocals, projectRoot) {
  assert(_.isObject(pageDef));
  assert(_.isObject(pageDataLocals));
  assert(_.isString(srcRoot));

  // Relative path from page output directory to site root.
  const pageOutputRelPath = path.dirname(pageDef.dist);
  let publicPath = `${path.relative(`/${pageOutputRelPath}`, '/')}/`;
  if (publicPath === '/') publicPath = '';

  //
  // Global compile-time constants, passed via EnvironmentPlugin.
  //
  const compileConstants = {
    PROD: true,
    PRODUCTION: true,
    CONFIG: configSpec,
    PAGE_DEF: pageDef,
    PUBLIC_PATH: publicPath,
    NODE_ENV: 'development',
  };

  const envConstants = _.fromPairs(_.map(_.toPairs(compileConstants), (pair) => {
    return [`process.env.${pair[0]}`, json(pair[1])];
  }));

  //
  // Create Webpack loaders.
  //

  //
  // Markup loader: Pug (formerly Jade)
  //
  const PugLoader = {<commit_msg>Fix: wrong compile-time constants in dev mode.<commit_after>/* eslint-disable global-require,import/no-dynamic-require */
const _ = require('lodash'),
  assert = require('assert'),
  json = JSON.stringify,
  path = require('path'),
  webpack = require('webpack'),
  ExtractTextPlugin = require('extract-text-webpack-plugin'),
  HtmlWebpackPlugin = require('html-webpack-plugin')
  ;

const VERSIONED_DIR = '__ver__';

module.exports = function genDevConfig(pageDef, srcRoot, outputRoot,
  configSpec, entryPoints, pageDataLocals, projectRoot) {
  assert(_.isObject(pageDef));
  assert(_.isObject(pageDataLocals));
  assert(_.isString(srcRoot));

  // Relative path from page output directory to site root.
  const pageOutputRelPath = path.dirname(pageDef.dist);
  let publicPath = `${path.relative(`/${pageOutputRelPath}`, '/')}/`;
  if (publicPath === '/') publicPath = '';

  //
  // Global compile-time constants, passed via EnvironmentPlugin.
  //
  const compileConstants = {
    DEBUG: true,
    DEV: true,
    DEVELOPMENT: true,
    CONFIG: configSpec,
    PAGE_DEF: pageDef,
    PUBLIC_PATH: publicPath,
    NODE_ENV: 'development',
  };

  const envConstants = _.fromPairs(_.map(_.toPairs(compileConstants), (pair) => {
    return [`process.env.${pair[0]}`, json(pair[1])];
  }));

  //
  // Create Webpack loaders.
  //

  //
  // Markup loader: Pug (formerly Jade)
  //
  const PugLoader = {
{'fraction_non_alphanumeric': 0.15577342047930284, 'fraction_numerical': 0.0014524328249818446, 'mean_word_length': 3.9461400359066428, 'pattern_counts': {'":': 0, '<': 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': '2195409', 'n_tokens_mistral': 898, 'n_tokens_neox': 878, 'n_words': 182}