当我运行pub build时,我尝试而不是获得这样的消息:

WARN: [Dart2JS on mylib|web/mylib.dart]:
    | 1 warning(s) and 2 hint(s) suppressed in package:otherlib.
WARN: [Dart2JS on pinged|web/mylib.dart]:
    | 2 warning(s) suppressed in package:mylib.
WARN: [Warning from Dart2JS on mylib|web/mylib.dart]:
    | 1 hint(s) suppressed in package:mypackage.
WARN: [Warning from Dart2JS on pinged|web/mylib.dart]:
    | 1 hint(s) suppressed in package:otherpackage.

我尝试使用pub build --verbose --trace构建并将--verbose添加到pubspec.yaml中的$ dart2js转换器commandLineOptions中。

似乎默认情况下,dart2js不会而不是抑制提示和警告(因此--suppress-warnings--suppress-hints选项),但是dart2js周围的pub build“wrapper”更改了这些默认设置,并没有提供启用冗长性的真正方法。

最佳答案

transformers:
- polymer:
    entry_points: web/index.html
- $dart2js:
    commandLineOptions: [--show-package-warnings]

也可以看看:

Can you pass compiler flags to dart2js via Dart Editor

https://www.dartlang.org/tools/pub/dart2js-transformer.html

10-08 03:35