-
David Iglesias authored
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` (and all other modules that used a browserify-like loading header) didn't work because they 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](https://github.com/flutter/engine/pull/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: * https://github.com/flutter/flutter/issues/126131 (and others) This PR hides a bit of code that is commonly used by module loaders to decide that they may use the `define` function provided by requireJS (so the engine workaround can be removed). ## Next steps * https://github.com/flutter/engine/pull/42941 ## Issues Partially addresses: https://github.com/flutter/flutter/issues/126131 (and others) ## Tests * Added a unit test to ensure the `delete` stays * Manually tested with the Gallery app in `debug` mode with a bunch of user-supplied scripts that currently fail to load. * Also tested hot restart as suggested by @nshahan