Problems with pub [...] serve
Using pub [...] serve I get the following error messages (yes i made a clean pub get, pub serve): [SEVERE] build_web_compilers|ddc on package:resource/resource.dartdevc.module: Error compiling dartdevc module:resource|lib/resource.ddc.js
[error] Target of URI doesn't exist: 'io_none.dart'. (package:resource/src/resource_loader.dart, line 8, col 8) [error] Target of URI doesn't exist: 'io_io.dart'. (package:resource/src/resource_loader.dart, line 10, col 26)
Please fix all errors before compiling (warnings are okay). } [...] [SEVERE] build_web_compilers|ddc on package:time_machine/time_machine.dartdevc.module: Error compiling dartdevc module:time_machine|lib/time_machine.ddc.js
[error] Target of URI doesn't exist: 'src/platforms/vm.dart'. (package:time_machine/time_machine.dart, line 12, col 24)
Please fix all errors before compiling (warnings are okay). }
When I change the imports and remove the "SEVERE" ones, I can run the app. I only use LocalDate in my app.
That's weird. Is this only happening for DDC? Will this also happen for Dart2JS as wel? If you're only using LocalDate you don't need to do any initialize calls at the beginning ~ those load the timezone database and discover your local timezone (for ZonedDateTime)
If I use the build process, the analyzer throws no error. Haven't checked, if it ist working deployed to an web server. I am just starting with the project (and this is the first dart project for me, too).
We have this issue with DDC and have found a workaround. The problem is Config specific imports don't work with analyzer/ddc (dart-lang/sdk#34177) with related open issue https://github.com/dart-lang/sdk/issues/33347. Time_machine has a dependency on https://github.com/dart-lang/resource which has open issue https://github.com/dart-lang/resource/issues/30.
The workaround is mentioned in https://github.com/dart-lang/sdk/issues/34177
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 :).
For development we change time_machine.dart import statements to:
// ignore: URI_DOES_NOT_EXIST
import 'src/platforms/platform_io.dart'
// `dart.library.js` is compatible with node and browser via dart2js -- `dart.library.html` will only work for the browser
// or at lest it seemed it should be, when I tried `dart.library.js` in chrome, it failed to evaluate to true
// ignore: URI_DOES_NOT_EXIST
if (dart.library.html) 'src/platforms/web.dart'
// ignore: URI_DOES_NOT_EXIST
if (dart.library.io) 'src/platforms/vm.dart'
as timeMachine;
and the resource dependency resource_loader.dart imports to:
// ignore: URI_DOES_NOT_EXIST
import "io_none.dart"
// ignore: URI_DOES_NOT_EXIST
if (dart.library.html) "io_html.dart"
// ignore: URI_DOES_NOT_EXIST
if (dart.library.io) "io_io.dart" as io;
We can then run under DDC and it has no impact on Dart2JS or the Dart VM.