李恒道 发表于 2023-2-22 21:20:06

webpack配置多入口多输出模板

配置文件
```js
const path = require("path");
const HTMLWebpackPlugin = require("html-webpack-plugin");

module.exports = {
entry: { main1: "./entry1.js", main2: "./entry2.js" },
output: {
    filename: ".js",
    path: path.resolve(__dirname, "dist"),
},
plugins: [
    new HTMLWebpackPlugin({
      chunks: ['main1'],
      filename: "index1.html",
    }),
    new HTMLWebpackPlugin({
      chunks: ['main2'],
      filename: "index2.html",
    }),
],
};

```
页: [1]
查看完整版本: webpack配置多入口多输出模板