• 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
.github Loading commit data...
.vscode Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.cirrus.yml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...