迁移到 Dart 2 我得到一个 "check imports error" 这意味着一些模板还没有生成

Migrating to Dart 2 I get a "check imports error" that means that some templates have not been generated

我正在尝试迁移到 Dart 2,我有很多软件包,到目前为止我可以顺利完成我的工作。 现在我得到一个奇怪的错误机器人与 DDC 和 dart2js:

[SEVERE] build_web_compilers|entrypoint on web/main.dart (cached):
Unable to find modules for some sources, this is usually the result of either a
bad import, a missing dependency in a package (or possibly a dev_dependency
needs to move to a real dependency), or a build failure (if importing a
generated file).

Please check the following imports:

`import 'package:ledger_web/src/ui/components/main_selection_bar.template.dart';` from ledger_web|lib/src/ui/components/service/main_selection_bar_service.dart at 7:1
`import 'package:ledger_web/src/ui/components/main_selection_bar.template.dart';` from ledger_web|lib/src/ui/components/service/main_selection_bar_service.template.dart at 11:1

...以及更多

表示没有导入是正确的(MainSelectionBar 是一个 angular 组件),因为模板尚未生成。 现在的问题是,为什么没有模板呢? 我检查了 .dart_tool/build/generated 目录,但尚未创建模板。 我有一个类似的包,其中包含一个可以正常工作的类似组件,所以我无法弄清楚发生了什么。 有没有地方有更详细的错误列表? 有意思的是,还有一种情况,模板是存在的,但是却像没找到一样列出来.... 有什么提示吗?

这很可能与生成模板时的构建失败有关,后续构建中未正确报告该错误。此拉取请求应该有助于 https://github.com/dart-lang/build/pull/1834/,但您也可以尝试 运行 pub run build_runner clean,然后进行新构建以恢复原始错误。