WASM incorrectly advertises dart.library.js #55801
Labels
area-dart2wasm
Issues for the dart2wasm compiler.
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
web-js-interop
Issues that impact all js interop
Currently, when compiling in WASM mode, the
dart.library.js
environment constant is set to true. This constant is used in particular in multi-platform applications to determine when the compilation target is a JS environment and as such various JS-interop libraries, such asdart:js
,dart:js_util
, and thejs
package are safe to load. However, this is not true in a WASM environment, causing numerous build failures (which are particularly difficult to debug because they don't include traces indicating the import chain that caused them).Here's a minimal reproduction:
When compiled with
dart compile wasm test.dart
, this producesThe text was updated successfully, but these errors were encountered: