• 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
..
android Loading commit data...
base Loading commit data...
build_system Loading commit data...
commands Loading commit data...
custom_devices Loading commit data...
dap Loading commit data...
dart Loading commit data...
drive Loading commit data...
fuchsia Loading commit data...
intellij Loading commit data...
ios Loading commit data...
linux Loading commit data...
macos Loading commit data...
migrations Loading commit data...
proxied_devices Loading commit data...
reporting Loading commit data...
runner Loading commit data...
test Loading commit data...
tester Loading commit data...
vscode Loading commit data...
web Loading commit data...
windows Loading commit data...
analytics_test.dart Loading commit data...
android_plugin_test.dart Loading commit data...
application_package_test.dart Loading commit data...
args_test.dart Loading commit data...
artifact_updater_test.dart Loading commit data...
artifacts_test.dart Loading commit data...
asset_bundle_package_fonts_test.dart Loading commit data...
asset_bundle_package_test.dart Loading commit data...
asset_bundle_test.dart Loading commit data...
asset_bundle_variant_test.dart Loading commit data...
asset_test.dart Loading commit data...
base_utils_test.dart Loading commit data...
build_info_test.dart Loading commit data...
bundle_builder_test.dart Loading commit data...
cache_test.dart Loading commit data...
channel_test.dart Loading commit data...
cmake_test.dart Loading commit data...
cold_test.dart Loading commit data...
common_test.dart Loading commit data...
compile_batch_test.dart Loading commit data...
compile_expression_test.dart Loading commit data...
compile_incremental_test.dart Loading commit data...
compile_test.dart Loading commit data...
config_test.dart Loading commit data...
convert_test.dart Loading commit data...
coverage_collector_test.dart Loading commit data...
crash_reporting_test.dart Loading commit data...
create_config_test.dart Loading commit data...
daemon_test.dart Loading commit data...
dart_plugin_test.dart Loading commit data...
desktop_device_test.dart Loading commit data...
devfs_test.dart Loading commit data...
device_port_forwarder_test.dart Loading commit data...
device_test.dart Loading commit data...
devtools_launcher_test.dart Loading commit data...
emulator_test.dart Loading commit data...
fake_process_manager_test.dart Loading commit data...
features_test.dart Loading commit data...
flutter_manifest_test.dart Loading commit data...
flutter_platform_test.dart Loading commit data...
flutter_project_metadata_test.dart Loading commit data...
flutter_tester_device_test.dart Loading commit data...
flutter_validator_test.dart Loading commit data...
generate_localizations_test.dart Loading commit data...
github_template_test.dart Loading commit data...
hot_test.dart Loading commit data...
html_utils_test.dart Loading commit data...
integration_test_device_test.dart Loading commit data...
license_collector_test.dart Loading commit data...
mdns_discovery_test.dart Loading commit data...
message_parser_test.dart Loading commit data...
persistent_tool_state_test.dart Loading commit data...
plugin_parsing_test.dart Loading commit data...
plugins_test.dart Loading commit data...
preview_device_test.dart Loading commit data...
project_file_invalidator_test.dart Loading commit data...
project_test.dart Loading commit data...
project_validator_result_test.dart Loading commit data...
protocol_discovery_test.dart Loading commit data...
pub_dependencies_project_validator_test.dart Loading commit data...
resident_devtools_handler_test.dart Loading commit data...
resident_runner_test.dart Loading commit data...
resident_web_runner_cold_test.dart Loading commit data...
resident_web_runner_test.dart Loading commit data...
template_test.dart Loading commit data...
terminal_handler_test.dart Loading commit data...
testbed_test.dart Loading commit data...
time_test.dart Loading commit data...
tracing_test.dart Loading commit data...
update_packages_test.dart Loading commit data...
utils_test.dart Loading commit data...
version_test.dart Loading commit data...
vmservice_test.dart Loading commit data...
windows_version_validator_test.dart Loading commit data...
xcode_backend_test.dart Loading commit data...