parallel-webpack icon indicating copy to clipboard operation
parallel-webpack copied to clipboard

`env` variable is not passed as first parameter to configuration function

Open egmanoj opened this issue 7 years ago • 2 comments

Explain the problem

parallel-webpack is not passing an env parameter when configuration uses a function of the form:

module.exports = (env) => {
    console.log("env: ", env);  // Prints: env: {}
    return myConfig;  
} 

Expected Behaviour

A valid env should be passed as first parameter to the configuration function.

Actual Behaviour

env is an empty dictionary.

Steps to reproduce

  1. Install parallel-webpack locally (using yarn, in my case)
  2. Create a simple module with a configuration function of the form given above
  3. Invoke as shown below:
$ ./node_modules/.bin/parallel-webpack --env.production=true

Provide your Environment details

  • Node version: v8.12.0
  • Operating System: Ubuntu 14.04.1 LTS
  • webpack version: 4.16.5
  • parallel-webpack version: 2.3.0

egmanoj avatar Oct 15 '18 09:10 egmanoj

It should work fine if you run your build using this command: $ ./node_modules/.bin/parallel-webpack -- --env.production=true The issue with that I run into is that I'm currently having build commands as part of package.json -> scripts which also need "--" to pass arguments. So I ended up having something like that: npm run build -- -- --env.name=ci --env.brand=b1 --env.configBrand=b1 which looks bad. So if you could make it work egmanoj described, then it would be easier to replace webpack with parallel-webpack when using CLI

Woodahs avatar Oct 23 '18 11:10 Woodahs

I just hit this, is anyone working on it?

sontek avatar May 13 '20 01:05 sontek