<commit_before>/* eslint-disable global-require */
const path = require('path');
const webpack = require('webpack');

const config = {
  name: 'server',
  target: 'node',
  devtool: 'source-map',
  entry: [path.resolve(__dirname, '../../init/server.js')],
  output: {
    path: path.resolve(__dirname, '../../../../.build/pwa/server'),
    filename: '[name].js',
    libraryTarget: 'commonjs2',
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            forceEnv: 'server',
          },
        },
      },
      {
        test: /\.css$/,<commit_msg>Add externals to server prod<commit_after>/* eslint-disable global-require */
const fs = require('fs');
const path = require('path');
const webpack = require('webpack');

// if you're specifying externals to leave unbundled, you need to tell Webpack
// to still bundle `react-universal-component`, `webpack-flush-chunks` and
// `require-universal-module` so that they know they are running
// within Webpack and can properly make connections to client modules:
const externals = fs
  .readdirSync(path.resolve(__dirname, '../../../../node_modules'))
  .filter(x => !/\.bin|react-universal-component|webpack-flush-chunks/.test(x))
  .reduce((external, mod) => {
    external[mod] = `commonjs ${mod}`;
    return external;
  }, {});

externals['react-dom/server'] = 'commonjs react-dom/server';

const config = {
  name: 'server',
  target: 'node',
  devtool: 'source-map',
  entry: [path.resolve(__dirname, '../../init/server.js')],
  output: {
    path: path.resolve(__dirname, '../../../../.build/pwa/server'),
    filename: '[name].js',
    libraryTarget: 'commonjs2',
  },
  externals,
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            forceEnv: 'server',
          },
        },
      },
      {
        test: /\.css$/,
{'fraction_non_alphanumeric': 0.1879661859771258, 'fraction_numerical': 0.000994530084535057, 'mean_word_length': 2.3645484949832776, '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': '2258050', 'n_tokens_mistral': 631, 'n_tokens_neox': 624, 'n_words': 144}