universal_html icon indicating copy to clipboard operation
universal_html copied to clipboard

Changes to conditional imports throw when building with DDC/dart2js

Open daniel-v opened this issue 3 years ago • 0 comments

Changes introduced in build_modules: 4.0.2 prevent me from building with DDC and dart2js. The changes in v4.0.2 prevent any conditional imports/exports for packages starting with dart:.

For more info, please see https://github.com/dart-lang/build/issues/3173

A workaround/fix would be to introduce an indirection.

// new file: dart_js.dart
export 'dart:js';

// in js.dart
library universal_html.js;

export 'dart_js.dart'
    if (dart.library.io) 'src/js.dart'; // VM

This indirection should fix it but ... ehh, I wonder why this change was needed.

daniel-v avatar Aug 19 '21 05:08 daniel-v