text: const path = require("path");
  const webpack = require("webpack");
  const HtmlWebpackPlugin = require("html-webpack-plugin");
  const { CleanWebpackPlugin } = require("clean-webpack-plugin");
  const CopyPlugin = require("copy-webpack-plugin");
  
  module.exports = {
      entry: {
          main: "./src/index.ts"
      },
      optimization: {
          splitChunks: {
              cacheGroups: {
                  phaser: {
                      test: /[\\/]node_modules[\\/]phaser[\\/]/,
                      name: "phaser",
                      chunks: "all",
                  },
              }
          }
      },
      output: {
          path: path.resolve(__dirname, "dist"),
          filename: "[name]-[contenthash].bundle.js",
          assetModuleFilename: "asset-packs/[name]-[hash][ext][query]",
      },
      module: {
          rules: [
              {
                  test: /\.tsx?$/,
                  use: "ts-loader",
                  exclude: /node_modules/,
              },
              {
                  test: /\.json/,
                  type: "asset/resource"
              }
          ],
      },
      resolve: {
          extensions: [".tsx", ".ts", ".js"],
      },
      devServer: {
          historyApiFallback: true,
          allowedHosts: 'all',
          static: {
              directory: path.resolve(__dirname, "./dist"),
          },
          open: true,
          hot: true,
          port: 8080,
      },
      plugins: [
          new HtmlWebpackPlugin({
              template: path.join(__dirname, "src/index.html"),
              minify: false
          }),
          new CleanWebpackPlugin(),
          new CopyPlugin({
              patterns: [
                  {
                      from: "static",
                      globOptions: {
                          // asset pack files are imported in code as modules
                          ignore: ["**/publicroot", "**/*-pack.json"]
                      }
                  }
              ]
          }),
          new webpack.HotModuleReplacementPlugin(),
      ]
  };