[web] Hides that Flutter uses requireJS in debug.#129032
[web] Hides that Flutter uses requireJS in debug.#129032auto-submit[bot] merged 3 commits intoflutter:masterfrom
Conversation
| // Prevent DDC's requireJS to interfere with modern bundling. | ||
| if (typeof define === 'function' && define.amd) { | ||
| // Preserve a copy just in case... | ||
| define._amd = define.amd; |
There was a problem hiding this comment.
This bit is probably unnecessary. I'm not sure how anybody could be relying on this, when this is only exposed in debug mode (unless they're publishing the debug version of their web app, 😱)
After flutter/flutter#129032, this shouldn't be needed anymore.
|
@ditman is this one ready to merge? |
|
@christopherfujino yes, but I'm gardening for flutter/packages and was waiting until monday to land this, so I can pay attention to potential breakages caused by this. I'll add the |
|
auto label is removed for flutter/flutter, pr: 129032, Mergeability of pull request flutter/flutter/129032 could not be determined at time of merge.. |
This comment was marked as outdated.
This comment was marked as outdated.
|
auto label is removed for flutter/flutter, pr: 129032, due to - The status or check suite Windows build_tests_1_4 has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
Try again, again, my beloved bot! |
After flutter/flutter#129032, this shouldn't be needed anymore.
**This must land _after_ flutter/flutter#129032 Flutter web uses requireJS in `debug` mode to assemble a DDC-compiled app from a bunch of small files ("modules"). This caused that `canvaskit.js` (then, but probably all other modules that used a browserify-like loading header) didn't work because it attempted to use the `define` function provided by Flutter's instance of `requireJS` (which kept the defined modules private, rather than as globals on the page, as the users of the JS expected). A [fix](#27342) was added to `flutter/engine` to trick loaders into *not* using the `requireJS` module loader, but a recent change in the fix's js-interop layer *subtly* changed its JS output on the page (objects went from `undefined` to `null`), causing this: * flutter/flutter#126131 (and others) After flutter/flutter#129032, the engine fix shouldn't be required anymore, so this PR removes it. ## Issues * Fixes flutter/flutter#126131 (and possibly others) ## Testing * Manually tested with some test apps, and miscellanous JS scripts as reported by users. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
**This must land _after_ flutter/flutter#129032 Flutter web uses requireJS in `debug` mode to assemble a DDC-compiled app from a bunch of small files ("modules"). This caused that `canvaskit.js` (then, but probably all other modules that used a browserify-like loading header) didn't work because it attempted to use the `define` function provided by Flutter's instance of `requireJS` (which kept the defined modules private, rather than as globals on the page, as the users of the JS expected). A [fix](flutter#27342) was added to `flutter/engine` to trick loaders into *not* using the `requireJS` module loader, but a recent change in the fix's js-interop layer *subtly* changed its JS output on the page (objects went from `undefined` to `null`), causing this: * flutter/flutter#126131 (and others) After flutter/flutter#129032, the engine fix shouldn't be required anymore, so this PR removes it. ## Issues * Fixes flutter/flutter#126131 (and possibly others) ## Testing * Manually tested with some test apps, and miscellanous JS scripts as reported by users. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Flutter web uses requireJS in
debugmode to assemble a DDC-compiled app from a bunch of small files ("modules").This caused that
canvaskit.js(and all other modules that used a browserify-like loading header) didn't work because they attempted to use thedefinefunction provided by Flutter's instance ofrequireJS(which kept the defined modules private, rather than as globals on the page, as the users of the JS expected).A fix was added to
flutter/engineto trick loaders into not using therequireJSmodule loader, but a recent change in the fix's js-interop layer subtly changed its JS output on the page (objects went fromundefinedtonull), causing this:This PR hides a bit of code that is commonly used by module loaders to decide that they may use the
definefunction provided by requireJS (so the engine workaround can be removed).Next steps
Issues
Partially addresses: #126131 (and others)
Tests
deletestaysdebugmode with a bunch of user-supplied scripts that currently fail to load.Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.