-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest patch (Q4 2021 Patch 3) fails to load #5932
Comments
Thanks to this, it works. |
Thanks for reporting! We are currently working on a fix for this, but in the meantime we have reverted the patch so version 7.20211209.4 should work as expected. |
O.K., I came up with a fix for this issue yesterday—for which I will submit a PR shortly—but I realised I was confused about why it should even have been necessary so in the mean time I advised @alschmiedt to submit #5938 to revert the release until I could be sure that my fix was actually correct. Here's the deal. As noted in this (and other) bug reports, the error is indeed caused by the line root.Blockly.blocks.all = factory(root.Blockly); in My first take was: of course this will fail, because while But then, while verifying my fix, I noticed / remembered that, because of how Unfortunately, while Here ends today's lesson on the order of evaluation of JavaScript expressions. |
I've also looked in to why this issue was not picked up in testing. It turns out that:
In PR #5835, @alschmiedt has somewhat rectified this by having the playgrounds load |
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 google#5932.
* 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.
Closing since the fix to this was releasing version |
Describe the bug
The latest patch (Q4 2021 Patch 3) fails to load
To Reproduce
Try to load Blockly as specified with examples.
Resolution
This seems to be fixed by changing line from
blockly/blocks_compressed.js
Line 10 in caba596
to
root.Blockly.blocks = factory(root.Blockly);
The text was updated successfully, but these errors were encountered: