dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
791 stars 210 forks source link

Question: Is there an option to compile dart:io libraries without implementation? #3614

Open ykmnkmi opened 11 months ago

ykmnkmi commented 11 months ago

I'm trying to use some libraries in a web application that depend on the watcher package's ChangeType and the file package's MemoryFileSystem classes. I can compile the application with dart2js, but not with ddc. As the application grows, the compile time also increases.

jakemac53 commented 11 months ago

We do not support compiling web projects with unsupported imports. This shouldn't be allowed even for dart2js builds using build_runner, although regular dart2js may support it.

The file package is an interesting case, because it is using dart:io just as an interface. I do wish we had the ability to support that, but in general dart:io is not supposed to be allowed, an exception was made only for flutter web and the intention has always been that it should be temporary. We don't want to proliferate that exception to any web project.