Repository navigation
Closed
Labels
a: buildBuilding flutter applications with the toolBuilding flutter applications with the toola: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkplatform-webWeb applications specificallyWeb applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
Currently, when compiling a web project with flutter build web --wasm (or evaluating compat via dry-run) that encounters incompatible legacy JS interop dependencies (such as dart:html or package:js), the terminal output suffers from two usability defects:
- Uncaught ProcessException Dump (Standard Wasm Builds):
flutter_toolsinvokesProcessUtils.run(throwOnError: !compilerConfig.dryRun). Expected compiler failures (exit code 254) during standard--wasmbuilds are treated as unexpected tool exceptions, dumping a 2,000+ character compiler sub-command string and a 22-frame internal Dart tool stack trace (_DefaultProcessUtils.run,Dart2WasmTarget.build, etc.). This buries the useful dependency tree context generated by the Dart compiler under noise and makes user error look like a tool crash. - Missing Actionable Remediation (Wasm Builds & Dry-Runs): When compilation aborts or dry-runs detect legacy web libraries (
dart:html,package:js), zero explicit guidance is given on how to migrate to WebAssembly-compatible packages (dry-runs only print a generic docs URL).
Proposed Changes
- Modify
Dart2WasmTarget.buildto invokeProcessUtils.run(throwOnError: false). - On non-zero exit codes during non-dry-run builds, directly forward uncorrupted compiler
stdoutandstderrtoenvironment.loggerwithout throwing an unformattedProcessException. - Add a new shortlink helper constant in
lib/src/web/web_constants.dartalongsidekWasmMoreInfotargetinghttps://flutter.dev/to/wasm-errors(which will redirect tohttps://docs.flutter.dev/platform-integration/web/wasm#diagnosing-wasm-compilation-errors). - In both fatal
--wasmcompilations and Wasm dry-run finding outputs (_handleDryRunResult), inspect output streams for instances of'dart:html'or'package:js'. When present, append an educational remediation footer:Note: WebAssembly compilation failed due to legacy web imports. Migrate your project from dart:html and package:js to package:web and dart:js_interop. See https://flutter.dev/to/wasm-errors for diagnostic and migration guidance.
- For fatal
--wasmbuilds, terminate execution cleanly viathrowToolExit('Failed to compile application for the Web.'), preventing internal tool stack trace spillage.
Metadata
Metadata
Assignees
Labels
a: buildBuilding flutter applications with the toolBuilding flutter applications with the toola: error messageError messages from the Flutter frameworkError messages from the Flutter frameworkplatform-webWeb applications specificallyWeb applications specificallytoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Activity
feat(web): expand legacy Wasm import heuristic to all web libraries
[tool][web] Intercept dart2wasm errors & append JS migration footers (f…
github-actions commentedon Aug 18, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.