/* global __dirname module */

const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const configFile = require('./internals/config')();

const config = {
    name: 'Client',
    devtool: 'source-map',
    context: path.join(__dirname, 'app'),
    entry: {
        vendor: './vendor.js',
        index: './main.js',
    },
    mode: 'production',
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, configFile.outputPath),
        publicPath: configFile.publicPath,
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules)/,
                use: [
                    {
                        loader: 'babel-loader',
                    }
                ]
            },
            {
                test: /\.(css|scss)$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    {
                        loader: 'css-loader',
                        options: {
                            modules: false,
                            importLoaders: 1,
                        }
                    },
                    'postcss-loader',
                    'sass-loader',
                ]
            },
            {
                test: /\.*$/,
                include: /assets/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            name: '[path][name].[ext]',
                        }
                    },
                ]
            },
            {
                test: /\.md$/,
                loader: 'ignore-loader'
            },
        ]
    },
    stats: {
        colors: true,
        hash: false,
        modules: false,
        children: false,
    },
    externals: {
        React: 'react',
        ReactDOM: 'react-dom'
    },
    resolve: {
        alias: {
            Containers: path.resolve(__dirname, 'app/containers/'),
            Components: path.resolve(__dirname, 'app/components/'),
            i18n: path.resolve(__dirname, 'app/i18n'),
            Styles: path.resolve(__dirname, 'app/styles'),
            Utils: path.resolve(__dirname, 'app/utils')
        }
    },
    plugins: [
        new MiniCssExtractPlugin({
            filename: '[name].css',
            chunkFilename: '[id].css',
        }),
        new CopyWebpackPlugin([
            {
                from: 'assets/**',
                to: path.resolve(__dirname, configFile.outputPath),
            }
        ]),
    ]
};

module.exports = config;

@@ -354,39 +354,8 @@
 : %7B%0A
-        vendor: './vendor.js',%0A
     
@@ -1763,24 +1763,138 @@
    %5D%0A    %7D,%0A
+    optimization: %7B%0A        splitChunks: %7B%0A            chunks: 'all',%0A            name: 'vendor'%0A        %7D%0A    %7D,%0A
     stats: %7B
@@ -1997,86 +1997,8 @@
  %7D,%0A
-    externals: %7B%0A        React: 'react',%0A        ReactDOM: 'react-dom'%0A    %7D,%0A
     

Fix optimization