const path = require("path");
const HTMLWebpackPlugin = require("html-webpack-plugin");
const srcPath = path.join(__dirname, "03-webpack-demo", "src", "index.js");
console.log("打包路径", srcPath);
module.exports = {
mode: "development",
entry: srcPath,
output: {
filename: "bundle.js",
path: path.join(__dirname, "dist"),
},
plugins: [
new HTMLWebpackPlugin({
template: path.join(__dirname, "03-webpack-demo", "src", "index.html"),
filename: "index.html",
}),
],
devServer: {
port: 3001,
contentBase: path.join(__dirname, "dist"),
},
};