<-

using webpack5

 

 webpack already does not need a config file:

npx webpack --mode=production --entry ./index.js --output-path dist/ --output-filename main.js

 

manual adding a config file, export can be single or array, webpack.config.js:

import path from "path";

export default [
  {
    mode: "production",
    entry: "./index.js",
    output: {
      path: path.resolve("./dist/"),
      filename: "bundle.js",
    },
  },
  {
    mode: "production",
    entry: "./index1.js",
    output: {
      filename: "bundle1.js",
    },
  },
];

 

posted @ 2026-04-16 07:43  calochCN  阅读(12)  评论(0)    收藏  举报