const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const path = require("path");
const webpack = require("webpack");
const { merge } = require("webpack-merge");
const commonWebpack = require("./webpack.config.common");

/**
 * @type import("webpack").Configuration
 */
const configuration = {
  devServer: {
    port: 3000,
    hot: true,
    open: true,
    compress: true,
    contentBase: path.resolve(__dirname, "../dist"),
    index : "index.html",
    historyApiFallback: true,
  },
  mode: "development",
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new ReactRefreshWebpackPlugin(),
  ],
  devtool: "eval",
};

module.exports = merge(commonWebpack, configuration);
