• David Iglesias's avatar
    [web] Hides that Flutter uses requireJS in debug. (#129032) · 34b42acf
    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
    34b42acf
Name
Last commit
Last update
..
migrations Loading commit data...
bootstrap_test.dart Loading commit data...
compile_web_test.dart Loading commit data...
devfs_web_test.dart Loading commit data...
devices_test.dart Loading commit data...
golden_comparator_process_test.dart Loading commit data...
golden_comparator_test.dart Loading commit data...
memory_fs_test.dart Loading commit data...
web_asset_server_test.dart Loading commit data...
web_expression_compiler_test.dart Loading commit data...
web_validator_test.dart Loading commit data...
workflow_test.dart Loading commit data...