0

我正在尝试迁移到 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 是一个角度组件),因为尚未生成模板。现在的问题是,为什么没有模板?我检查了 .dart_tool/build/generated 目录,但尚未创建模板。我有一个类似的包,它有一个类似的组件,可以正常工作,所以我不知道发生了什么。有没有更详细的错误列表的地方?有趣的是,还有一个模板存在的情况,但是它被列出来就像没有找到一样......有什么提示吗?

4

1 回答 1

2

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

于 2018-09-20T14:09:19.340 回答