flutter/packages/flutter_tools/test
David Iglesias 34b42acf1b
[web] Hides that Flutter uses requireJS in debug. (#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` (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
2023-06-23 02:09:12 +00:00
..
commands.shard Fix an ordering dependency in the flutter_tools upgrade test (#129131) 2023-06-19 11:18:16 -07:00
data Bump lower Dart SDK constraints to 3.0 & add class modifiers (#122546) 2023-03-21 20:21:58 +00:00
general.shard [web] Hides that Flutter uses requireJS in debug. (#129032) 2023-06-23 02:09:12 +00:00
host_cross_arch.shard [flutter_tools] Use process matcher for multidex test (#127996) 2023-06-01 22:24:08 +00:00
integration.shard [flutter_tools] Migrate more integration tests to process result matcher (#128737) 2023-06-15 13:25:32 -07:00
src [flutter_tools] cache flutter sdk version to disk (#124558) 2023-06-15 00:20:30 +00:00
web.shard Add vmservice for android build options (#123034) 2023-04-18 18:16:09 +00:00