text: const path = require('path');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  const CssMinimizerWebpackPlugin = require('css-minimizer-webpack-plugin');
  const CopyPlugin = require('copy-webpack-plugin');
  const Dotenv = require('dotenv-webpack');
  const TerserWebpackPlugin = require('terser-webpack-plugin');
  const { CleanWebpackPlugin } = require('clean-webpack-plugin');
  
  module.exports = {
      entry: './src/index.js',
      output: {
          path: path.resolve(__dirname, 'dist'),
          filename: 'bundle.js',
          publicPath: '/',
          assetModuleFilename: 'assets/img/[name][ext][query]'
      },
      resolve: {
          extensions: ['.js', '.jsx'],
      },
      mode: 'production',
      module: {
          rules: [
              {
                  test: /\.(js|jsx)$/,
                  exclude: /node_modules/,
                  use: {
                      loader: 'babel-loader'
                  }
              },
              {
                  test: /\.html$/,
                  use: {
                      loader: 'html-loader'
                  }
              },
              {
                  test: /\.jpg|png|gif/,
                  type: "asset/resource",
              },
              {
                  test: /\.scss$/,
                  use: [
                      {
                        loader: MiniCssExtractPlugin.loader,
                      },
                      'css-loader',
                      'sass-loader'
                    ],            
              }
          ]
      },
      plugins: [
          new HtmlWebpackPlugin({
              template: './public/index.html',
              filename: 'index.html',
              favicon: './public/favicon.ico'            
              }),
          new MiniCssExtractPlugin({
              filename: './styles/[name].css',
              }),
          new CopyPlugin({
              patterns : [
                  {
                  from: path.resolve(__dirname, "src", "assets/img"),
                  to: "./assets/img"
                  }
              ]
              }),
          new Dotenv(),
          new CleanWebpackPlugin(),
      ],
      devServer: {
          historyApiFallback: true
        },
      optimization: {
          minimize: true,
          minimizer: [
              new CssMinimizerWebpackPlugin({
                  minify: CssMinimizerWebpackPlugin.cleanCssMinify,
              }),
              new TerserWebpackPlugin()
          ]
      }
      
  }