聚合物+ Dart2js不工作

编程入门 行业动态 更新时间:2024-10-25 18:25:13
本文介绍了聚合物+ Dart2js不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我使用Polymer库创建一个新的应用程序时,它会生成一个示例项目。该项目在Dartium中工作正常,但是当我编译它(使用 pub build ),它不工作了。

When I create a new application using the Polymer library, it generates a sample project. The project works just fine in Dartium, but when I compile it (using pub build), it doesn't work anymore.

我得到两个404和一个未捕获的类型错误。

I get two 404's and an uncaught typeerror.

这是我的控制台输出在Chrome。

Here is my console output in 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。

These files exist in build/web/packages/, so I'm not sure why I'm getting a 404.

这工作正常,我更新到最新的Dart SDK(开发渠道)。

This worked fine before I updated to the latest Dart SDK (dev channel). Is it just a bug in there, what might be going on?

感谢。

更新:

我看到一个 Dart问题,我遇到了另一个问题,因此我应用了他们的 fix 到示例项目,现在我只得到 Uncaught TypeError 。现在我的输出如下所示:

I saw a Dart issue that I was having another issue with, so I applied their fix to the sample project, and now I only get the Uncaught TypeError. Now my output looks like this:

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

推荐答案

我通过在聚合物上放置依赖项约束来工作。我的pubspec.yaml文件现在看起来像这样:

I got it to work by placing a dependency constraint on polymer. My pubspec.yaml file now looks like this:

name: sample description: A sample Polymer application dependencies: browser: any polymer: "0.9.5" transformers: - polymer: entry_points: web/sample.html

更多推荐

聚合物+ Dart2js不工作

本文发布于:2023-08-02 14:22:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1278485.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:聚合物   工作   Dart2js

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!