Open itsjustkevin opened 6 months ago
Item | Details |
---|---|
Summary | Dart2Wasm error messages are not easily visible. |
Triage to | area-dart2wasm |
This looks more like a CFE issue.
Also for most compilers one wants to look at the very first error, which is pretty clear
┌─ Experimental feature ───────────────────────────────┐
│ WebAssembly compilation is experimental. │
│ See https://flutter.dev/wasm for more information. │
└──────────────────────────────────────────────────────┘
Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 64:
NOTE: Compilation to WasmGC is experimental.
The support may change, or be removed, with no advance notice.
../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:6:8: Error: Dart library 'dart:html' is not available on this platform.
import 'dart:html' as html;
^
Context: The unavailable library 'dart:html' is imported through these packages:
Because following errors are usually consequences of the first.
As far as I can see the first error is the root cause (dart:html
not being available).
@itsjustkevin What (other?) result would you have preferred in this case?
@johnniwinther this may be a special case, due to the fact that dart:html
is not WASM compatible, that I am looking at from a user perspective.
As a user attempting a Wasm build of my Flutter app, I might have thousands of lines of errors returned, making it difficult for me to hunt for the issues.
For the users, it may be helpful to append the offending libraries to the output:
The following libraries are unavailable:
dart:html
dart:convert
dart:math
Dart2Wasm errors are not easily visible.
Background
When attempting a Flutter Wasm build while utilizing a plugin or package that is not yet migrated, the error logged before logging the offending error in the package/plugin, followed by the stack trace.
This makes it difficult to immediately understand what the issue is.
Expectation
I would expect that the error is logged at the end.
Error log
Wasm build error log
➜ wasm_test flutter build web --wasm ┌─ Experimental feature ───────────────────────────────┐ │ WebAssembly compilation is experimental. │ │ See https://flutter.dev/wasm for more information. │ └──────────────────────────────────────────────────────┘ Target dart2wasm failed: ProcessException: Process exited abnormally with exit code 64: *NOTE*: Compilation to WasmGC is experimental. The support may change, or be removed, with no advance notice. ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:6:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ Context: The unavailable library 'dart:html' is imported through these packages: web_plugin_registrant.dart => package:camera_web => dart:html Detailed import paths for (some of) the these imports: main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/camera_service.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera_service.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/camera_service.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/camera_error_code.dart => dart:html main.dart => web_plugin_registrant.dart => package:camera_web/camera_web.dart => package:camera_web/src/camera_web.dart => package:camera_web/src/types/types.dart => package:camera_web/src/types/zoom_level_capability.dart => dart:html ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera.dart:6:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_service.dart:5:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/camera_error_code.dart:5:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/types/zoom_level_capability.dart:5:8: Error: Dart library 'dart:html' is not available on this platform. import 'dart:html' as html; ^ ../../.pub-cache/hosted/pub.dev/camera_web-0.3.2+4/lib/src/camera_web.dart:61:37: Error: Type 'html.Event' not found. final Map
System