I have been working on a prototype to support config specific imports properly in package:build, and I have gotten something to work, but during compilation I get errors like this:
Error compiling dartdevc module:_test|web/main.ddc.js
[error] Target of URI doesn't exist: 'default.dart'. (/web/main.dart, line 7, col 8)
[error] Target of URI doesn't exist: 'ui.dart'. (/web/main.dart, line 8, col 26)
[error] Target of URI doesn't exist: 'io.dart'. (/web/main.dart, line 9, col 26)
Please fix all errors before compiling (warnings are okay).
my imports look like this:
import 'default.dart'
if (dart.library.ui) 'ui.dart'
if (dart.library.io) 'io.dart'
if (dart.library.html) 'web.dart';
Note that you don’t see the error about web.dart
, because I did in fact provide that one (because I knew it was the only one that would actually be loaded).
I can work around the issue with // ignore: URI_DOES_NOT_EXIST
comments (although I need one for every single condition…), but that shouldn’t be necessary :).
It looks like this error is probably coming from the analyzer, but I am unsure if I should assign it to the dev_compiler or analyzer areas – assigning to analyzer for now but please switch if you feel that is incorrect.
That should just work with the current specification: Section ‘URIs’ specifies how to select one of the choices in a configurable import, and this does not involve any actions for the non-chosen ones (like checking whether there is such a library). On top of that, the interpretation of a URI is mainly implementation specified.
Thanks for weighing in!
OK, glad to have that clarified and I was thinking from a non-realistic point.
This definitely makes the correct solution here for the analyzer to not report missing URI on default.dart, and that’s what we’ll do once we get to this.