stealjs / steal-tools

Build easy. Load fast.
https://stealjs.com/docs/steal-tools.html
MIT License
66 stars 23 forks source link

Fix race condition where last format transform overrides previous ones #1149

Closed m-mujica closed 4 years ago

m-mujica commented 4 years ago

The transform function resolved by transformInput was handling the bundle concatenation to the event loop too early, causing future transforms (sharing the same graph) to reset the activeSourceKeys object -where the result of transpiled graphs are kept- before the bundle was concatenated.

This meant the last transform would override all of the previous ones, instead of doing return Promise.resolve().then(concatenateBundle), this commit creates a new promise that runs concatenateBundle right away instead of waiting for the next tick (and opening the window from future transforms to mutate the graph).

Closes #1139

m-mujica commented 4 years ago

tenor

matthewp commented 4 years ago

lgtm, awesome work