<commit_before>const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const SvgStorePlugin = require('webpack-external-svg-sprite');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const { ReactLoadablePlugin } = require('react-loadable/webpack');
const WriteFilePlugin = require('write-file-webpack-plugin');

// PostCSS, TODO: node-css-mqpacker, postcss-sprites
const sassImportOnce = require('node-sass-import-once');
const postcssFlexbugsFixes = require('postcss-flexbugs-fixes');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');

const env = process.env.NODE_ENV;
const isDev = env === 'development';

const browsers = [
    '> 1%',
    'last 4 versions',
    'Firefox ESR',
    'not ie <= 10',
    'not bb <= 10'
];

module.exports = {
    entry: {
        app: path.join(__dirname, 'bootstrap', 'client', 'index.js')
    },
    output: {
        publicPath: '/assets/',
        path: path.join(__dirname, 'static', 'assets'),
        filename: 'js/[name].js',
        chunkFilename: 'js/[name].chunk.js'
    },
    resolve: {
        modules: [
            __dirname,
            'node_modules'
        ],
        extensions: ['.js']
    },
    mode: isDev ? 'development' : 'production',
    watch: false,
    bail: false,
    profile: true,
    devtool: isDev ? 'cheap-source-map' : 'source-map',
    stats: {
        assets: false,
        hash: false,
        version: false,
        chunks: false
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: [
                    /node_modules/,
                    /static/
                ],
                use: [
                    {
                        loader: 'babel-loader',
                        options: {
                            babelrc: false,
                            presets: [
                                [
                                    'env',
                                    {
                                        targets: { browsers },
                                        modules: false,
                                        useBuiltIns: true,
                                        exclude: [
                                            'transform-exponentiation-operator',
                                        ]
                                    }
                                ],
                                'flow',
                                'react'
                            ],
                            plugins: [
                                'syntax-dynamic-import',
                                'transform-decorators-legacy',
                                'transform-class-properties',
                                'transform-object-rest-spread',
                                [
                                    'transform-runtime',
                                    {
                                        'helpers': false,
                                        'polyfill': false,
                                        'regenerator': true
                                    }
                                ],
                                'react-loadable/babel'
                            ]
                        }
                    }
                ]
            },
            {
                test: /app\/modules\/(.*)\/components\/(.*)\/index\.js$/,
                loader: 'dependency-loader',
                options: {
                    injections: [
                        'index.scss'
                    ]
                }
            },
            {
                test: /\.scss$/,
                exclude: [
                    /node_modules/,
                    /static/
                ],
                use: [
                    MiniCssExtractPlugin.loader,
                    {
                        loader: 'css-loader',
                        options: {
                            importLoaders: 2
                        }
                    },
                    {
                        loader: 'postcss-loader',
                        options: {
                            plugins: [
                                postcssFlexbugsFixes(),
                                autoprefixer({ browsers })
                            ]
                        }
                    },
                    {
                        loader: 'sass-loader',
                        options: {
                            importer: sassImportOnce,
                            importOnce: {
                                index: true
                            },
                            includePaths: [
                                path.resolve(__dirname)
                            ]
                        }
                    }
                ]
            }
        ]
    },
    plugins: (function () {
        const plugins = [
            new webpack.ContextReplacementPlugin(/app[/\\]modules/, false),
            new SvgStorePlugin({
                directory: path.resolve(__dirname, 'app', 'images'),
                name: 'images/sprite.svg',
                prefix: 'icon-',
            }),
            new MiniCssExtractPlugin({
                filename: '[name].css',
                chunkFilename: '[name].chunk.css'
            }),
            new ReactLoadablePlugin({
                filename: path.join('build', 'react-loadable.json')
            })
        ];

        if (isDev) {
            plugins.push(
                new WriteFilePlugin({
                    test: /react-loadable\.json$/
                })
            );
        }

        return plugins;
    })(),
    optimization: {
        splitChunks: {
            cacheGroups: {
                vendor: {
                    test: /[\\/]node_modules[\\/]/,
                    name: 'vendor',
                    chunks: 'all'
                }
            }
        },
        runtimeChunk: {
            name: 'manifest',
        },<commit_msg>add ModuleConcatenationPlugin<commit_after>const path = require('path');
const webpack = require('webpack');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const SvgStorePlugin = require('webpack-external-svg-sprite');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const { ReactLoadablePlugin } = require('react-loadable/webpack');
const WriteFilePlugin = require('write-file-webpack-plugin');

// PostCSS, TODO: node-css-mqpacker, postcss-sprites
const sassImportOnce = require('node-sass-import-once');
const postcssFlexbugsFixes = require('postcss-flexbugs-fixes');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');

const env = process.env.NODE_ENV;
const isDev = env === 'development';

const browsers = [
    '> 1%',
    'last 4 versions',
    'Firefox ESR',
    'not ie <= 10',
    'not bb <= 10'
];

module.exports = {
    entry: {
        app: path.join(__dirname, 'bootstrap', 'client', 'index.js')
    },
    output: {
        publicPath: '/assets/',
        path: path.join(__dirname, 'static', 'assets'),
        filename: 'js/[name].js',
        chunkFilename: 'js/[name].chunk.js'
    },
    resolve: {
        modules: [
            __dirname,
            'node_modules'
        ],
        extensions: ['.js']
    },
    mode: isDev ? 'development' : 'production',
    watch: false,
    bail: false,
    profile: true,
    devtool: isDev ? 'cheap-source-map' : 'source-map',
    stats: {
        assets: false,
        hash: false,
        version: false,
        chunks: false
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: [
                    /node_modules/,
                    /static/
                ],
                use: [
                    {
                        loader: 'babel-loader',
                        options: {
                            babelrc: false,
                            presets: [
                                [
                                    'env',
                                    {
                                        targets: { browsers },
                                        modules: false,
                                        useBuiltIns: true,
                                        exclude: [
                                            'transform-exponentiation-operator',
                                        ]
                                    }
                                ],
                                'flow',
                                'react'
                            ],
                            plugins: [
                                'syntax-dynamic-import',
                                'transform-decorators-legacy',
                                'transform-class-properties',
                                'transform-object-rest-spread',
                                [
                                    'transform-runtime',
                                    {
                                        'helpers': false,
                                        'polyfill': false,
                                        'regenerator': true
                                    }
                                ],
                                'react-loadable/babel'
                            ]
                        }
                    }
                ]
            },
            {
                test: /app\/modules\/(.*)\/components\/(.*)\/index\.js$/,
                loader: 'dependency-loader',
                options: {
                    injections: [
                        'index.scss'
                    ]
                }
            },
            {
                test: /\.scss$/,
                exclude: [
                    /node_modules/,
                    /static/
                ],
                use: [
                    MiniCssExtractPlugin.loader,
                    {
                        loader: 'css-loader',
                        options: {
                            importLoaders: 2
                        }
                    },
                    {
                        loader: 'postcss-loader',
                        options: {
                            plugins: [
                                postcssFlexbugsFixes(),
                                autoprefixer({ browsers })
                            ]
                        }
                    },
                    {
                        loader: 'sass-loader',
                        options: {
                            importer: sassImportOnce,
                            importOnce: {
                                index: true
                            },
                            includePaths: [
                                path.resolve(__dirname)
                            ]
                        }
                    }
                ]
            }
        ]
    },
    plugins: (function () {
        const plugins = [
            new webpack.ContextReplacementPlugin(/app[/\\]modules/, false),
            new SvgStorePlugin({
                directory: path.resolve(__dirname, 'app', 'images'),
                name: 'images/sprite.svg',
                prefix: 'icon-',
            }),
            new MiniCssExtractPlugin({
                filename: '[name].css',
                chunkFilename: '[name].chunk.css'
            }),
            new ReactLoadablePlugin({
                filename: path.join('build', 'react-loadable.json')
            })
        ];

        if (isDev) {
            plugins.push(
                new WriteFilePlugin({
                    test: /react-loadable\.json$/
                })
            );
        } else {
            plugins.push(
                new webpack.optimize.ModuleConcatenationPlugin(),
            );
        }

        return plugins;
    })(),
    optimization: {
        splitChunks: {
            cacheGroups: {
                vendor: {
                    test: /[\\/]node_modules[\\/]/,
                    name: 'vendor',
                    chunks: 'all'
                }
            }
        },
        runtimeChunk: {
            name: 'manifest',
        },
{'fraction_non_alphanumeric': 0.10355548469387756, 'fraction_numerical': 0.0011160714285714285, 'mean_word_length': 0.7749009620826259, 'pattern_counts': {'":': 0, '<': 7, '<?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': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1410729', 'n_tokens_mistral': 2930, 'n_tokens_neox': 2730, 'n_words': 469}