2 thoughts on “Add CLI option for selecting a config from a multi-config webpack.config.js file

  1. you can probably do that with js like this
    webpack.config.server.js
    webpack.config.client.js
    webpack.config.js

    module.exports = function(env = {}) {
      var serverConfig = require('webpack.config.server');
      var clientConfig = require('webpack.config.client');
      var isDefaultConfig = env.server === undefined && env.client  === undefined;
      var config = [serverConfig, clientConfig];
      return isDefaultConfig ? config : config.filter(conf => Boolean(conf));
    }

    webpack
    webpack –env.server
    webpack –env.client
    or
    webpack –config webpack.config.client.ts
    webpack –config webpack.config.server.ts

Comments are closed.