function setEnv(constants) {
  const setter = context => prevConfig => {
    context.setEnv = Object.assign({}, context.setEnv, toObject(constants))
    return prevConfig
  }

  return Object.assign(setter, { post: addEnvironmentPlugin })
}
Replaces constants in your source code with values from `process.env`
using the `webpack.EnvironmentPlugin`.

Using `setEnv` multiple times results in a single
EnvironmentPlugin instance configured to do all the replacements.

@param {string[]|object} constants
@return {Function}