const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const PATHS = {
    app: path.join(__dirname, 'app'),
    dist: path.join(__dirname, 'dist'),
};

module.exports = {
    context: PATHS.app,
    entry: path.join(PATHS.app, 'scripts', 'index.tsx'),
    output: {
        path: PATHS.dist,
        filename: 'assets/scripts/bundle.[hash].js',
        chunkFilename: 'assets/scripts/[id].[hash].js',
        publicPath: '/',
    },
    resolve: {
        extensions: ['.js', '.jsx', '.ts', '.tsx'],
    },
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                exclude: /node_modules/,
                use: ['babel-loader', 'ts-loader'],
            },
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                loader: 'babel-loader',
            },
            {
                test: /\.html$/,
                exclude: /node_modules/,
                loader: 'html-loader',
            },
            {
                test: /\.htaccess$/,
                use: {
                    loader: 'file-loader',
                    options: {
                        name: '.htaccess',
                    },
                },
            },
            {
                test: /(favicon|humans|robots)\.(ico|txt)$/,
                use: {
                    loader: 'file-loader',
                    options: {
                        name: '[name].[ext]',
                    },
                },
            },
            {
                test: /\.(xml|json|txt)$/,
                include: /content|images|manifest|scripts|styles/,
                type: 'javascript/auto',
                use: {
                    loader: 'file-loader',
                    options: {
                        name: '[path][name].[ext]',
                        outputPath: 'assets/',
                    },
                },
            },
            {
                test: /\.(jpe?g|png|svg|gif)$/,
                include: /content|images|manifest|scripts|styles/,
                use: [
                    {
                        loader: 'file-loader',
                        options: {
                            name: '[path][name].[ext]',
                            outputPath: 'assets/',
                        },
                    },
                    'image-webpack-loader',
                ],
            },
        ],
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: path.join(PATHS.app, 'index.html'),
            filename: 'index.html',
        }),
        new HtmlWebpackPlugin({
            template: path.join(PATHS.app, '403.html'),
            filename: '403.html',
            inject: false,
        }),
        new HtmlWebpackPlugin({
            template: path.join(PATHS.app, '404.html'),
            filename: '404.html',
            inject: false,
        }),
    ],
};

@@ -1193,24 +1193,65 @@
 .htaccess',%0A
+                        esModule: false,%0A
             
@@ -1253,32 +1253,32 @@
              %7D,%0A
-
                 
@@ -1505,32 +1505,73 @@
 '%5Bname%5D.%5Bext%5D',%0A
+                        esModule: false,%0A
                 
@@ -1690,32 +1690,24 @@
   include: /
-content%7C
 images%7Cmanif
@@ -1956,32 +1956,73 @@
 ath: 'assets/',%0A
+                        esModule: false,%0A
                 
@@ -2154,16 +2154,8 @@
 e: /
-content%7C
 imag
@@ -2358,32 +2358,32 @@
 %5D%5Bname%5D.%5Bext%5D',%0A
-
                 
@@ -2409,32 +2409,77 @@
 ath: 'assets/',%0A
+                            esModule: false,%0A
                 

Disable esModule option for file-loader