text: /* eslint-disable @typescript-eslint/no-var-requires */
  const path = require('path');
  const webpack = require('webpack');
  const Dotenv = require('dotenv-webpack');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  
  const isDevelopment = process.env.NODE_ENV === 'development';
  
  module.exports = {
      entry: {
          main: './src/index.tsx'
      },
      resolve: {
          extensions: ['.ts', '.tsx', '.js', '.scss'],
          alias: {
              '@common': path.resolve(__dirname, 'src/common'),
              '@components': path.resolve(__dirname, 'src/components'),
              '@views': path.resolve(__dirname, 'src/views')
          }
      },
      output: {
          path: path.join(__dirname, './dist'),
          filename: 'app.min.js'
      },
      module: {
          rules: [
              {
                  test: /\.tsx?$/,
                  exclude: /node_modules/,
                  loader: 'ts-loader'
              },
              {
                  test: /\.css$/,
                  use: ['style-loader', 'css-loader'],
              },
              {
                  test: /\.(png|jpe?g|gif)$/,
                  use: [
                      {
                          loader: 'file-loader',
                          options: {
                              name: '[name].[ext]',
                          },
                      },
                  ],
              },
              {
                  test: /\.svg/,
                  use: {
                    loader: "svg-url-loader",
                    options: {
                      // make all svg images to work in IE
                      iesafe: true,
                    },
                  },
              },
              {
                  test: /\.(png|jpg|gif|svg)$/,
                  use: [
                      {
                          loader: 'file-loader',
                          options: {}
                      }
                  ]
              }
          ]
      },
      devServer: {
          historyApiFallback: true,
          hot: false
      },
      watchOptions: {
          ignored: /node_modules/
      },
      plugins: [
          new webpack.HotModuleReplacementPlugin(),
          new HtmlWebpackPlugin({
              template: './public/index.html'
          }),
          new MiniCssExtractPlugin({
              filename: isDevelopment ? '[name].css' : '[name].[hash].css',
              chunkFilename: isDevelopment ? '[id].css' : '[id].[hash].css'
          }),
          new Dotenv()
      ]
  };
  