text: const path = require("path");
  const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  const CopyPlugin = require("copy-webpack-plugin");
  
  module.exports = {
    mode: "production",
    entry: "./src/index.js",
    output: {
      filename: "index.js",
      path: path.resolve(__dirname, "dist"),
    },
    plugins: [
      new CopyPlugin({
        patterns: [
          { from: "src/fonts", to: "assets/fonts" },
          { from: "src/icons", to: "assets/icons" },
          { from: "src/images", to: "assets/images" },
        ],
      }),
      new MiniCssExtractPlugin({
        filename: ({ chunk }) => `${chunk.name.replace("/js/", "/css/")}.css`,
      }),
    ],
    module: {
      rules: [
        {
          test: /\.css$/,
          use: [MiniCssExtractPlugin.loader, "css-loader"],
        },
        {
          test: /\.s[ac]ss$/i,
          use: [
            // Creates `style` nodes from JS strings
            "style-loader",
            // Translates CSS into CommonJS
            "css-loader",
            // Compiles Sass to CSS
            "sass-loader",
          ],
        },
      ],
    },
  };
  