Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(build): Correctly handle deep export paths in UMD wrapper (#5945)
* fix(build): Correctly handle deep export paths A problem can occur when loading chunks in a browser: although factory() will create the full exported path on $, and thus the assignment root.<path> = factory(...) { ...; return $.<path> } will normally be a do-nothing in every chunk except the first, if the exported path (e.g. Blockly.blocks.all) is more than one level deeper than any previously-existing path (e.g. Blockly), this will fail because root.<path> is evaluated before calling factory(), and so the left hand side will will evaluate to a undefined reference (e.g. undefined.all) and TypeError will be thrown before the call to factory is evaluated. To fix this, call factory first and store the exports object in a variable before assigning it to the exported path. Fixes #5932.
- Loading branch information