【问题标题】:Aurelia-Polymer Using CLI toolAurelia-Polymer 使用 CLI 工具
【发布时间】:2016-08-24 15:48:30
【问题描述】:

我一直在尝试解决这个问题;我的目标是在 Aurelia 框架中使用 Polymer 模块。有一个教程here(在官方文档上),但这不适用于 CLI 生成的应用程序。

我的 aurelia.json 文件具有以下依赖项:

…
"aurelia-html-import-template-loader",
"aurelia-polymer",
…

(使用 npm 安装)

index.html 文件如下所示:

<head>
<title>Aurelia</title>

<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="bower_components/polymer/polymer.html">

我在构建时在 CLI/控制台中没有错误。

ma​​in.js

aurelia.use.plugin('aurelia-polymer');

加载正常,但是

aurelia.use.plugin('aurelia-html-import-template-loader');

在浏览器控制台中给出错误:

vendor-bundle.js:21513 GET http://localhost:9000/app.html 
Unhandled rejection Error: Load timeout for modules: template-registry- ………

我一直在与 aurelia/gitter 上的一群小伙子交谈,但到目前为止,我发现没有人能够让 'aurelia-html-import-template-loader' 在 CLI 中工作。

感谢阅读, 度过美好的一天

【问题讨论】:

    标签: javascript web aurelia


    【解决方案1】:

    来自aurelia-polymer

    与 Webpack 一起使用

    如果你使用 webpack,你将无法使用 aurelia-html-import-template-loader,这意味着您将无法 直接在模板中加载 Polymer 元素(参见 #18)。反而, 建议您使用vulcanize 捆绑所有 Polymer 您使用的元素到一个可以加载到 index.html 的文件中。这 加载后,模板中的元素仍然可用,但是 这避免了需要 HTML 导入模板的语法问题 装载机。

    我还没有用 aurelia-cli 尝试过,但值得一试。

    【讨论】:

      猜你喜欢
      • 2016-12-09
      • 1970-01-01
      • 2018-05-13
      • 2017-07-09
      • 2017-01-03
      • 1970-01-01
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多