trivago / parallel-webpack

Builds multi-config webpack projects in parallel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Array of promises vs promise of the array

Demivan opened this issue · comments

Explain the problem

When using webpack you can return promise from webpack config function. If you want multiple configurations you need to return a promise that returns an array of configs. parallel-webpack instead works only if you return array of promises.
This breaks compatibility with webpack and webpack-dev-server

Expected Behaviour

parallel-webpack should work same as webpack and correctly handle promise that returns array of configs.

Actual Behaviour

parallel-webpack sees only one target and then crashes because of error:
Unhandled rejection TypeError: Cannot read property 'filename' of undefined

Steps to reproduce

Create webpack config that returns promise that resolves to array instead of array of promises.

Provide your webpack config

module.exports = (env) => {
  return getTranslations().then(allTranslations => langs
    .map(lang => translations: allTranslations[lang])
    .map(translations => {
      return {
        entry: ...
        ...
      }
  }))
}

Provide your Environment details

  • Node version: 9.4.0
  • Operating System: Windows 10
  • webpack version: 3.6.0
  • parallel-webpack version: 2.2.0

Hi @efegurkan is there anyone working on this? I'd like to take this issue, thanks!

@chenesan We'd be happy if you took a look at this!

Anything on this yet, please? It's become really pressing here.

There's a PR from @chenesan here: #84
I'm waiting for it to come out of the "Work in Progress" state to review it.

Hi @pago
The issue has been fixed in that PR and I also added one test in it. But the change will break some tests
(see my comments in PR page). I'm not sure what's the best way for parallel-webpack to handle them. Could you review it, run the tests and give me some feedback? Thank you!

Any chance of getting this merged?