<commit_before>'use strict';

const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const autoprefixer = require('autoprefixer');
const CleanPlugin = require('./utils/clean-plugin');
const NodeUtils = require('./src/services/common/node-service');
const appConfig = require('./config/config');

const config = {
    output: {
        path    : path.join(__dirname, 'dist'),
        filename: 'bundle.js'
    },
    resolve: {
        extensions: ['.js', '.jsx', '.json']
    },
    plugins: [
        new CleanPlugin({
            files: ['dist/*']
        }),
        new ExtractTextPlugin('css/bundle.css'),
        new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
        new webpack.LoaderOptionsPlugin({
            options: {
                postcss: [
                    autoprefixer({
                        browsers: ['last 2 version']
                    })
                ]
            }
        }),
        new HtmlWebpackPlugin({
            template: path.resolve(__dirname, 'src/index.html'),
            inject  : 'body'
        }),
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: JSON.stringify(
                    process.env.NODE_ENV
                ),
                APP_CONFIG: JSON.stringify(
                    appConfig
                )
            }
        })
    ],
    module: {
        exprContextCritical: false, // Suppress "The request of a dependency is an expression"
        rules              : [
            {
                test   : /\.(js|jsx)$/,
                loaders: 'babel-loader',
                include: path.join(__dirname, 'src')
            },
            {
                test   : /\.scss$/,
                loader : ExtractTextPlugin.extract({fallback: 'style-loader', use: 'css-loader!sass-loader'}),
                include: path.join(__dirname, 'src')
            },
            {
                test   : /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
                loader : 'url-loader?limit=10000&name=[name]-[hash].[ext]',
                include: path.join(__dirname, 'src')
            },
            {
                test   : /\.json$/,
                loader : 'json-loader',
                include: path.join(__dirname, 'src')
            }
        ]
    }
};

if (NodeUtils.isProduction()) {
    config.entry = './src/Bootstrap';
    config.plugins.push(new UglifyJSPlugin());

} else {
    config.devtool = 'eval';
    config.entry = [
        'react-hot-loader/patch',
        `webpack-dev-server/client?http://localhost:${appConfig.example.port}`,
        'webpack/hot/only-dev-server',
        './src/Bootstrap'
    ];
    config.plugins.push(
        new webpack.HotModuleReplacementPlugin()
    );
}

module.exports = config;<commit_msg>#8: Adding fix for style hot reloading by @iafan<commit_after>'use strict';

const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const autoprefixer = require('autoprefixer');
const CleanPlugin = require('./utils/clean-plugin');
const NodeUtils = require('./src/services/common/node-service');
const appConfig = require('./config/config');

const config = {
    output: {
        path    : path.join(__dirname, 'dist'),
        filename: 'bundle.js'
    },
    resolve: {
        extensions: ['.js', '.jsx', '.json']
    },
    plugins: [
        new CleanPlugin({
            files: ['dist/*']
        }),
        new ExtractTextPlugin('css/bundle.css'),
        new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
        new webpack.LoaderOptionsPlugin({
            options: {
                postcss: [
                    autoprefixer({
                        browsers: ['last 2 version']
                    })
                ]
            }
        }),
        new HtmlWebpackPlugin({
            template: path.resolve(__dirname, 'src/index.html'),
            inject  : 'body'
        }),
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: JSON.stringify(
                    process.env.NODE_ENV
                ),
                APP_CONFIG: JSON.stringify(
                    appConfig
                )
            }
        })
    ],
    module: {
        exprContextCritical: false, // Suppress "The request of a dependency is an expression"
        rules              : [
            {
                test   : /\.(js|jsx)$/,
                loaders: 'babel-loader',
                include: path.join(__dirname, 'src')
            },
            {
                test  : /\.scss$/,
                loader: NodeUtils.isProduction()
                    ? ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!sass-loader' })
                    : 'style-loader!css-loader!sass-loader',
                include: path.join(__dirname, 'src')
            },
            {
                test   : /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
                loader : 'url-loader?limit=10000&name=[name]-[hash].[ext]',
                include: path.join(__dirname, 'src')
            },
            {
                test   : /\.json$/,
                loader : 'json-loader',
                include: path.join(__dirname, 'src')
            }
        ]
    }
};

if (NodeUtils.isProduction()) {
    config.entry = './src/Bootstrap';
    config.plugins.push(new UglifyJSPlugin());
} else {
    config.devtool = 'eval';
    config.entry = [
        'react-hot-loader/patch',
        `webpack-dev-server/client?http://localhost:${appConfig.example.port}`,
        'webpack/hot/only-dev-server',
        './src/Bootstrap'
    ];
    config.plugins.push(
        new webpack.HotModuleReplacementPlugin()
    );
}

module.exports = config;
{'fraction_non_alphanumeric': 0.14526524541398117, 'fraction_numerical': 0.002478929102627665, 'mean_word_length': 1.5863247863247862, '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': '3695954', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1653, 'n_words': 290}