Skip to content
This repository has been archived by the owner on Feb 7, 2022. It is now read-only.

env variable is not passed as first parameter to configuration function #88

Open
egmanoj opened this issue Oct 15, 2018 · 2 comments
Open

Comments

@egmanoj
Copy link

egmanoj commented Oct 15, 2018

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
@Woodahs
Copy link

Woodahs commented Oct 23, 2018

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

@sontek
Copy link

sontek commented May 13, 2020

I just hit this, is anyone working on it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants