docs(web): add Wasm compile error and migration guide - #13662
Conversation
Add step-by-step guidance for developers encountering compile-time failures when targeting WebAssembly during Flutter web builds. * Explains how to leverage dry-run warnings from `flutter build web` for early detection. * Instructs developers on isolating the structured dependency import chain tree from verbose exception stack traces during `--wasm` builds. * Documents migration strategies from legacy libraries (`dart:html`, `package:js`) to `package:web` and `dart:js_interop` via conditional imports. * Cross-links compilation error troubleshooting in FAQ and web building guides.
|
Staged preview of the updated docs.flutter.dev site (updated for commit 955e974): https://flutter-docs-prod--docs-pr13662-wasm-compile-error-doc-4ocvnk3a.web.app |
|
Staged preview of the updated flutter.dev site (updated for commit 955e974): https://flutter-dev-230821--www-pr13662-wasm-compile-error-doc-cbx3dvu6.web.app |
….dev * Inverts conditional imports in FAQ and Wasm guides so `dart.library.js` precedes `dart.library.js_interop` for legacy JS compilation fallback. * Adds direct inline links to dart.dev migration, usage, and conditional import documentation in the Wasm troubleshooting subsection.
There was a problem hiding this comment.
Code Review
This pull request adds a new section to the Flutter Web Wasm documentation titled "Diagnosing Wasm compilation errors" and links to it from the building and FAQ pages. The review feedback points out a critical logic error in the conditional import code examples across both faq.md and wasm.md: because dart.library.js_interop is supported on both JS-compiled web and WebAssembly, evaluating it last causes JS-compiled builds to incorrectly select the Wasm implementation. The reviewer also identified a minor grammatical typo in the newly added documentation.
* Removes redundant article from literal compiler output in troubleshooting reference block.
| { "source": "/to/use-mirror-site", "destination": "/community/china#configure-your-machine-to-use-a-mirror-site", "type": 301 }, | ||
| { "source": "/to/use-profile-mode", "destination": "/perf/ui-performance#run-in-profile-mode", "type": 301 }, | ||
| { "source": "/to/wasm", "destination": "/platform-integration/web/wasm", "type": 301 }, | ||
| { "source": "/to/wasm-errors", "destination": "/platform-integration/web/wasm#diagnosing-wasm-compilation-errors", "type": 301 }, |
There was a problem hiding this comment.
Add step-by-step guidance for developers encountering compile-time failures when targeting WebAssembly during Flutter web builds.
flutter build webfor early detection.--wasmbuilds.dart:html,package:js) topackage:webanddart:js_interopvia conditional imports.