當我使用聚合物庫創建新應用程序時,它會生成一個示例項目。該項目在Dartium中工作得很好,但當我編譯它時(使用pub build
),它不再工作。聚合物+ Dart2js不起作用
我得到兩個404和一個uncaught typeerror。
這是我在Chrome中的控制檯輸出。
GET file:///home/michael/Code/sample/build/web/packages/shadow_dom/shadow_dom.debug.js sample.html:1
GET file:///home/michael/Code/sample/build/web/packages/custom_element/custom-elements.debug.js sample.html:2
Uncaught TypeError: Object #<HTMLDocument> has no method 'registerElement' sample.html_bootstrap.dart.js:6681
wi sample.html_bootstrap.dart.js:6681
ei sample.html_bootstrap.dart.js:9102
Ok sample.html_bootstrap.dart.js:9099
QL sample.html_bootstrap.dart.js:2184
aX.vV sample.html_bootstrap.dart.js:759
Vg sample.html_bootstrap.dart.js:644
(anonymous function) sample.html_bootstrap.dart.js:12464
init.currentScript sample.html_bootstrap.dart.js:12444
(anonymous function) sample.html_bootstrap.dart.js:12458
(anonymous function) sample.html_bootstrap.dart.js:12585
這些文件存在於build/web/packages/
,所以我不知道爲什麼我得到一個404
這工作得很好之前,我更新到最新的SDK達特(開發版)。這只是一個錯誤,可能會發生什麼?
謝謝。
更新:
我看到了我跟另外一個問題一個Dart issue,所以我申請了fix到示例項目,現在我只得到了Uncaught TypeError
。現在我的輸出如下所示:
Uncaught TypeError: Object #<HTMLDocument> has no method 'registerElement' sample.html_bootstrap.dart.js:6518
wi sample.html_bootstrap.dart.js:6518
ei sample.html_bootstrap.dart.js:8949
Ok sample.html_bootstrap.dart.js:8946
QL sample.html_bootstrap.dart.js:2142
aX.vV sample.html_bootstrap.dart.js:725
Vg sample.html_bootstrap.dart.js:587
(anonymous function) sample.html_bootstrap.dart.js:12313
init.currentScript sample.html_bootstrap.dart.js:12293
(anonymous function) sample.html_bootstrap.dart.js:12307
(anonymous function) sample.html_bootstrap.dart.js:12434
我只是想說清楚,在運行pub構建之前,我沒有編輯任何東西。 –