如何为WebPack添加多个源和多个输出

时间:2018-07-12 11:36:26

标签: webpack minify webpack-2 uglifyjs webpack-4

我正在尝试从文件1->最小文件1文件2->最小文件2中缩小文件。如果有办法可以实现,请发表。

const path = require("path");

module.exports = {
entry: "./modules/users/client/controllers/admin/user.client.controller.js",
output: {
    path: path.resolve(__dirname,'modules/users/client/controllers/admin'),
    filename: "user.client.controller.js"
},
optimization: {
  minimize: true
}
};

module.exports = {
    entry: "./modules/users/client/controllers/admin/register-user.client.controller.js",
    output: {
        path: path.resolve(__dirname,'modules/users/client/controllers/admin'),
        filename: "register-user.client.controller.js"
    },
    optimization: {
      minimize: true
    }
    };

1 个答案:

答案 0 :(得分:0)

这解决了我的问题

const path = require("path");

module.exports = {
entry: {
  'users/client/controllers/admin/viewownerclientcontroller':['./modules/users/client/controllers/admin/viewownerclientcontroller.js']



},
output: {
  path: path.resolve(__dirname, 'modules'),
  filename:  '[name].js'
},

optimization: {
minimize: true
}
};