在Dart中编译Polymer应用程序

时间:2013-11-11 23:37:53

标签: javascript compilation dart polymer

我正在使用Dart 0.8.10_r30104(DEV)并发现它无法生成Javascript(应用程序本身可以在Dartrium中运行)。

当我选择在builder.dart上生成“生成Javascript”时出现错误:

--- Nov 12, 2013 7:35:43 AM Running dart2js... ---
F:\dart\dart-sdk\bin\dart2js.bat --out=E:\My Books\Sitepoint\Sample\build.dart.js E:\My Books\Sitepoint\Sample\build.dart
/E:/My Books/Sitepoint/Sample/packages/polymer/builder.dart:83:8: Error: Library not found 'dart:io'.
import 'dart:io';
   ^^^^^^^^^
/E:/My Books/Sitepoint/Sample/packages/polymer/src/build/linter.dart:11:8: Error: Library not found 'dart:io'.
import 'dart:io';
   ^^^^^^^^^
/E:/My Books/Sitepoint/Sample/packages/barback/src/asset.dart:9:8: Error: Library not    found 'dart:io'.
import 'dart:io';
   ^^^^^^^^^
...
/E:/My Books/Sitepoint/Sample/packages/analyzer/src/generated/element.dart:7220:17: Hint: The class 'VoidTypeImpl' overrides 'operator==', but not 'get hashCode'.
   bool operator ==(Object object) => identical(object, this);
            ^^
/E:/My Books/Sitepoint/Sample/packages/analyzer/src/generated/element.dart:4874:17:     Hint: The class 'PropertyAccessorElementImpl' overrides 'operator==', but not 'get hashCode'.
  bool operator ==(Object object) => super == object && identical(isGetter, ((object as PropertyAccessorElement)).isGetter);
            ^^
Error: Compilation failed.

===

出了什么问题?

1 个答案:

答案 0 :(得分:1)

要为聚合物应用生成JS,您需要在应用程序的顶层运行“pub build”。这将创建一个名为build的顶级目录,它将包含你的JS(以及指向JS的html)。