未处理的拒绝错误:模块的加载超时:template-registry-entry

时间:2016-09-08 20:35:47

标签: javascript requirejs aurelia requirejs-text

我们已经创建了一个插件,其本地演示工作正常。

https://github.com/shaunluttin/aurelia-open-id-connect/tree/master/src

然而,将插件安装到另一个项目中会因为这两个错误的序列而失败,这两个错误都抱怨open-id-connect-user-block.html视图/视图模型组件。

  

未捕获的TypeError:plugin.load不是函数

     

未处理的拒绝错误:模块的加载超时:template-registry-entry!aurelia-open-id-connect / open-id-connect-user-block.html_unnormalized2,template-registry-entry!aurelia-open-id-连接/开放式ID-连接 - 用户block.html,文字!Aurelia路上开-ID-CONNECT /开放式ID-连接 - 用户block.html_unnormalized3,文字!Aurelia路上开-ID-CONNECT /开放式ID-连接用户,block.html   http://requirejs.org/docs/errors.html#timeout

我们尝试了什么

在我们的插件的configure功能中将该组件添加为全局资源。

function configure(config: FrameworkConfiguration, callback: Function) {

    config.globalResources("./open-id-connect-user-block");

}

在使用应用程序的configure函数中添加插件。

export function configure(aurelia: Aurelia) {

  aurelia.use
    .standardConfiguration()
    .plugin("aurelia-open-id-connect", (callback) => callback(oidcConfig));

  aurelia.start().then(() => aurelia.setRoot());
}

在使用应用程序的aurelia.json文件中添加插件。

"bundles": [
  {
    "name": "open-id-bundle.js",
    "dependencies": [
      "oidc-client",
      {
        "name": "aurelia-open-id-connect", 
        "path": "../node_modules/aurelia-open-id-connect/dist/amd/es5/open-id-connect",
        "main": "index"
      }
    ]
  },

  // other bundles

]

requirejs/text插件设为stub:false

 "plugins": [
    {
      "name": "text",
      "extensions": [
        ".html",
        ".css"
      ],
      "stub":false 
    }

这会产生404新错误:

  

未处理拒绝错误:src /../ node_modules / aurelia-open-id-connect / dist / amd / es5 / open-id-connect / open-id-connect-user-block.html HTTP状态:404 < / p>

我们读过的内容

我们在GitHub上看到了这个问题:Installing normal Aurelia plugins, what Im I doing wrong?

  • 2016年7月3日,Aurelia CLI不支持包含HTML模板的插件。
  • 7月17日,它应该与版本0.16.1一起使用;我们使用的是0.18.0,但它无法正常工作。
  • 7月28日,要动态要求短信,需要在stub:false的{​​{1}}插件中设置text

0 个答案:

没有答案