<commit_before>const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const precss = require('precss');
const jsonImporter = require('node-sass-json-importer');

function getEntrySources(sources) {
  if (process.env.NODE_ENV !== 'production') {
    sources.push('webpack-hot-middleware/client');
    sources.unshift('react-hot-loader/patch');
  }
  return sources;
}

function getPlugins(plugins) {
  if (process.env.NODE_ENV !== 'production') {
    plugins.push(new webpack.HotModuleReplacementPlugin());
  }
  return plugins;
}

module.exports = {
  devtool: (process.env.NODE_ENV !== 'production') ? 'eval' : '',
  entry: getEntrySources([
    './frontend/src/index',
  ]),
  output: {
    path: path.join(__dirname, 'frontend', 'static', 'frontend'),
    filename: 'bundle.js',
    publicPath: '/dist/',
  },
  plugins: getPlugins([
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      },
    }),
  ]),
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: ['babel-loader'],
        include: path.join(__dirname, 'frontend', 'src'),
      },
      {
        test: /\.scss$/,
        use: [
            'style-loader',
            'css-loader',
            // From https://github.com/postcss/postcss-loader#plugins
            // sets postcss options without using a postcss.config.js
            // Default plugins from https://github.com/postcss/postcss#usage
            {loader: 'postcss-loader',
                ident: 'postcss',
                options: { plugins: () => [precss, autoprefixer]}},
            {loader: 'sass-loader',
             options: {importer: jsonImporter}},
        ],
        include: [
          path.resolve(__dirname, 'frontend', 'src/stylesheets'),
          path.resolve(__dirname, 'frontend', 'src/components'),
        ],
      },
      {
        test: /\.css$/,
        use: [
          'style-loader',
          'css-loader',
        ],
      },
      {
        test: /\.(ttf|eot|png|jpg|svg)(\?.*$|$)$/,
        use: [
          {
            loader: 'file-loader',
            options: {
              file: 'name=[name].[ext]'
            }
          }
        ]
      },
      {
        test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: '10000',
              mimetype: 'application/font-woff'
            }
          }
        ]
      },
    ],
  },
  resolve: {
    extensions: ['.js', '.jsx'],
  },
};
<commit_msg>upgrade to sass/json importer for v4.0<commit_after>const path = require('path');
const webpack = require('webpack');
const autoprefixer = require('autoprefixer');
const precss = require('precss');
const jsonImporter = require('node-sass-json-importer');

function getEntrySources(sources) {
  if (process.env.NODE_ENV !== 'production') {
    sources.push('webpack-hot-middleware/client');
    sources.unshift('react-hot-loader/patch');
  }
  return sources;
}

function getPlugins(plugins) {
  if (process.env.NODE_ENV !== 'production') {
    plugins.push(new webpack.HotModuleReplacementPlugin());
  }
  return plugins;
}

module.exports = {
  devtool: (process.env.NODE_ENV !== 'production') ? 'eval' : '',
  entry: getEntrySources([
    './frontend/src/index',
  ]),
  output: {
    path: path.join(__dirname, 'frontend', 'static', 'frontend'),
    filename: 'bundle.js',
    publicPath: '/dist/',
  },
  plugins: getPlugins([
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify(process.env.NODE_ENV),
      },
    }),
  ]),
  module: {
    rules: [
      {
        test: /\.jsx?$/,
        use: ['babel-loader'],
        include: path.join(__dirname, 'frontend', 'src'),
      },
      {
        test: /\.scss$/,
        use: [
            'style-loader',
            'css-loader',
            // From https://github.com/postcss/postcss-loader#plugins
            // sets postcss options without using a postcss.config.js
            // Default plugins from https://github.com/postcss/postcss#usage
            {loader: 'postcss-loader',
                ident: 'postcss',
                options: { plugins: () => [precss, autoprefixer]}},
            {loader: 'sass-loader',
             options: {importer: jsonImporter()}},
        ],
        include: [
          path.resolve(__dirname, 'frontend', 'src/stylesheets'),
          path.resolve(__dirname, 'frontend', 'src/components'),
        ],
      },
      {
        test: /\.css$/,
        use: [
          'style-loader',
          'css-loader',
        ],
      },
      {
        test: /\.(ttf|eot|png|jpg|svg)(\?.*$|$)$/,
        use: [
          {
            loader: 'file-loader',
            options: {
              file: 'name=[name].[ext]'
            }
          }
        ]
      },
      {
        test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
        use: [
          {
            loader: 'url-loader',
            options: {
              limit: '10000',
              mimetype: 'application/font-woff'
            }
          }
        ]
      },
    ],
  },
  resolve: {
    extensions: ['.js', '.jsx'],
  },
};

{'fraction_non_alphanumeric': 0.17810051595643034, 'fraction_numerical': 0.004968469329256641, 'mean_word_length': 1.8109559613319013, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '3467343', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1643, 'n_words': 271}