const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin"); module.exports = { mode: "development", entry: "./src/index.ts", devtool: "source-map", module: { rules: [ { test: /\.tsx?$/, use: "ts-loader", exclude: /node_modules/, }, ], }, resolve: { extensions: [".tsx", ".ts", ".js"], }, output: { filename: "index.js", path: path.resolve(__dirname, "dist"), }, plugins: [ new HtmlWebpackPlugin({ template: "src/index.html", }), new CopyWebpackPlugin({ patterns: [{ from: "src/index.css", to: "index.css" }], }), ], devServer: { static: { directory: path.join(__dirname, "dist"), }, compress: true, port: 9000, hot: true, open: true, historyApiFallback: true, }, };