trivago / parallel-webpack

Builds multi-config webpack projects in parallel
BSD 3-Clause "New" or "Revised" License
1.48k stars 96 forks source link

Array of promises vs promise of the array #76

Closed Demivan closed 5 years ago

Demivan commented 6 years ago

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

chenesan commented 6 years ago

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

pago commented 6 years ago

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

barbu110 commented 6 years ago

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

pago commented 6 years ago

There's a PR from @chenesan here: https://github.com/trivago/parallel-webpack/pull/84 I'm waiting for it to come out of the "Work in Progress" state to review it.

chenesan commented 6 years ago

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!

niksy commented 5 years ago

Any chance of getting this merged?