<commit_before>/* eslint import/no-extraneous-dependencies: 0 */
const path = require('path');
const webpack = require('webpack');
const ManifestRevisionPlugin = require('manifest-revision-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

// many of the webpack directives need an absolute path
const basedir = path.resolve(__dirname, '../');

const baseConfig = {
  entry: {
    // the entrypoint for shared CSS used across all the apps
    common_css: [path.resolve(basedir, 'src', 'styles', 'app', 'app.scss')],
  },
  plugins: [
    // needed this to get eslint working for some reason
    new webpack.LoaderOptionsPlugin({ options: {} }),
    // this writes JS files for our Flask server to read
    new ManifestRevisionPlugin(
      path.resolve(basedir, 'build', 'manifest.json'), // keep this path in sync with FlaskWebpack config
      { rootAssetPath: './src' } // important that this be relative, not absolute
    ),
    // this writes CSS files for our Flask server to read
    new MiniCssExtractPlugin({
      filename: '[name].[hash].css',
    }),
  ],
  module: {
    rules: [
      { // run linting check on all the javascript code before trying to compile it
        enforce: 'pre',
        test: /\.(js|jsx)$/,
        exclude: /node_modules/, // we don't want to check the imported packages for formatting
        use: 'eslint-loader', // use eslint as the engine for checking linting
      },
      { // compile all our javascript code
        test: /\.(js|jsx)$/,
        exclude: /node_modules/, // we don't want to recompile the imported packages
        use: {
          loader: 'babel-loader', // run all the code through bable to transpile it down to vanilla JS
          // don't put options here; otherwise they override what is in the .babelrc
        },
      },
      { // compile the scss for react-flexbox-grid by itself because it doesn't work wth MiniCssExtractPlugin for some reason<commit_msg>Use hard-source-webpack #1310<commit_after>/* eslint import/no-extraneous-dependencies: 0 */
const path = require('path');
const webpack = require('webpack');
const ManifestRevisionPlugin = require('manifest-revision-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');

// many of the webpack directives need an absolute path
const basedir = path.resolve(__dirname, '../');

const baseConfig = {
  entry: {
    // the entrypoint for shared CSS used across all the apps
    common_css: [path.resolve(basedir, 'src', 'styles', 'app', 'app.scss')],
  },
  plugins: [
    // needed this to get eslint working for some reason
    new webpack.LoaderOptionsPlugin({ options: {} }),
    // this writes JS files for our Flask server to read
    new ManifestRevisionPlugin(
      path.resolve(basedir, 'build', 'manifest.json'), // keep this path in sync with FlaskWebpack config
      { rootAssetPath: './src' } // important that this be relative, not absolute
    ),
    // this writes CSS files for our Flask server to read
    new MiniCssExtractPlugin({
      filename: '[name].[hash].css',
    }),
    // add an intermediate caching step to speed up builds (expect the first one)
    new HardSourceWebpackPlugin(),
  ],
  module: {
    rules: [
      { // run linting check on all the javascript code before trying to compile it
        enforce: 'pre',
        test: /\.(js|jsx)$/,
        exclude: /node_modules/, // we don't want to check the imported packages for formatting
        use: 'eslint-loader', // use eslint as the engine for checking linting
      },
      { // compile all our javascript code
        test: /\.(js|jsx)$/,
        exclude: /node_modules/, // we don't want to recompile the imported packages
        use: {
          loader: 'babel-loader', // run all the code through bable to transpile it down to vanilla JS
          // don't put options here; otherwise they override what is in the .babelrc
        },
      },
      { // compile the scss for react-flexbox-grid by itself because it doesn't work wth MiniCssExtractPlugin for some reason
{'fraction_non_alphanumeric': 0.11253630203291384, 'fraction_numerical': 0.001452081316553727, 'mean_word_length': 2.913825757575758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4599506', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1121, 'n_words': 435}