Webpack 联系人管理器教程中的Aurelia应用程序启动问题

Webpack 联系人管理器教程中的Aurelia应用程序启动问题,webpack,angular-ui-bootstrap,aurelia,Webpack,Angular Ui Bootstrap,Aurelia,我正在学习联系人管理器教程,当我添加路由器时,我的应用程序停止工作。如有任何提示,将不胜感激。加载bootstrap.css时出现问题。这是Chrome调试窗口的输出: DEBUG [aurelia] Loading plugin aurelia-templating-binding. vendor-bundle.js:13902 DEBUG [aurelia] Configured plugin aurelia-templating-binding. vendor-bundle.js:139

我正在学习联系人管理器教程,当我添加路由器时,我的应用程序停止工作。如有任何提示,将不胜感激。加载bootstrap.css时出现问题。这是Chrome调试窗口的输出:

DEBUG [aurelia] Loading plugin aurelia-templating-binding. vendor-bundle.js:13902

DEBUG [aurelia] Configured plugin aurelia-templating-binding. vendor-bundle.js:13902 

DEBUG [aurelia] Loading plugin aurelia-templating-resources. vendor-bundle.js:13902

DEBUG [aurelia] Configured plugin aurelia-templating-resources. vendor-bundle.js:13902

DEBUG [aurelia] Loading plugin aurelia-event-aggregator. vendor-bundle.js:13902

DEBUG [aurelia] Configured plugin aurelia-event-aggregator. vendor-bundle.js:13902

DEBUG [aurelia] Loading plugin aurelia-history-browser. vendor-bundle.js:13902

DEBUG [aurelia] Configured plugin aurelia-history-browser. vendor-bundle.js:13902

DEBUG [aurelia] Loading plugin aurelia-templating-router. vendor-bundle.js:13902

DEBUG [aurelia] Configured plugin aurelia-templating-router. vendor-bundle.js:13902

DEBUG [aurelia] Loading plugin resources/index. vendor-bundle.js:13902

DEBUG [aurelia] Configured plugin resources/index. vendor-bundle.js:13902 

DEBUG [aurelia] Loading plugin aurelia-testing. vendor-bundle.js:13902

DEBUG [aurelia] Configured plugin aurelia-testing. vendor-bundle.js:13902 

DEBUG [templating] importing resources for aurelia-templating-resources/compose [] vendor-bundle.js:13902

DEBUG [templating] importing resources for aurelia-templating-router/router-view [] vendor-bundle.js:13912

INFO [aurelia] Aurelia Started vendor-bundle.js:13902

DEBUG [templating] importing resources for app.html ["bootstrap/css/bootstrap.css", "styles.css"] vendor-bundle.js:4834

Uncaught TypeError: plugin.load is not a function

at Module.<anonymous> (vendor-bundle.js:4834)

at vendor-bundle.js:3873

at on (vendor-bundle.js:4256)

at Module.callPlugin (vendor-bundle.js:4694)

at Module.fetch (vendor-bundle.js:4563)

at Module.check (vendor-bundle.js:4595)

at Module.enable (vendor-bundle.js:4915)

at Object.enable (vendor-bundle.js:5296)

at Module.<anonymous> (vendor-bundle.js:4900)

at vendor-bundle.js:3873

at each (vendor-bundle.js:3798)

at Module.enable (vendor-bundle.js:4852)

at Module.init (vendor-bundle.js:4527)

at vendor-bundle.js:5199
DEBUG[aurelia]加载插件aurelia模板绑定。vendor bundle.js:13902
调试[aurelia]已配置插件aurelia模板绑定。vendor bundle.js:13902
调试[aurelia]加载插件aurelia模板资源。vendor bundle.js:13902
调试[aurelia]已配置插件aurelia模板资源。vendor bundle.js:13902
调试[aurelia]加载插件aurelia事件聚合器。vendor bundle.js:13902
调试[aurelia]配置的插件aurelia事件聚合器。vendor bundle.js:13902
调试[aurelia]加载插件aurelia历史浏览器。vendor bundle.js:13902
调试[aurelia]已配置插件aurelia历史浏览器。vendor bundle.js:13902
调试[aurelia]加载插件aurelia模板路由器。vendor bundle.js:13902
调试[aurelia]配置的插件aurelia模板路由器。vendor bundle.js:13902
调试[aurelia]加载插件资源/索引。vendor bundle.js:13902
调试[aurelia]配置的插件资源/索引。vendor bundle.js:13902
调试[aurelia]加载插件aurelia测试。vendor bundle.js:13902
调试[aurelia]已配置插件aurelia测试。vendor bundle.js:13902
调试[模板化]为aurelia模板化资源导入资源/compose[]vendor bundle.js:13902
调试[模板化]为aurelia模板化路由器导入资源/路由器视图[]供应商包。js:13912
信息[aurelia]aurelia启动了供应商包。js:13902
调试[模板]导入app.html[“bootstrap/css/bootstrap.css”,“styles.css”]供应商bundle.js:4834的资源
未捕获类型错误:plugin.load不是函数
在模块上。(vendor bundle.js:4834)
在vendor bundle.js:3873
在上(vendor bundle.js:4256)
位于Module.callPlugin(vendor bundle.js:4694)
在Module.fetch(vendor bundle.js:4563)
在Module.check(vendor bundle.js:4595)
在Module.enable(vendor bundle.js:4915)
在Object.enable(vendor bundle.js:5296)
在模块上。(vendor bundle.js:4900)
在vendor bundle.js:3873
在每个站点(vendor bundle.js:3798)
在Module.enable(vendor bundle.js:4852)
位于Module.init(vendor bundle.js:4527)
在vendor bundle.js:5199

最常见的错误是:

  • 您正在尝试加载css文件或其他基于文本的文件(如svg)
  • 此css文件/其他基于文本的文件不包括在捆绑包中
  • 属性设置为
    true
您可以执行以下两种操作之一:将css文件包含在捆绑包中,或者将属性设置为
false

我建议使用前者,这意味着在aurelia.json中配置
resources
属性:

{
  "name": "bootstrap",
  "path": "../node_modules/bootstrap/dist",
  "main": "js/bootstrap.min",
  "deps": ["jquery"],
  "exports": "$",
  "resources": [
    "css/bootstrap.css"
  ]
}

这将触发CLI绑定
bootstrap.css
文件。如果您将
stub
属性设置为
false
,则RequireJS将在包外获取bootstrap.css文件(因此将发生单独的请求)。

我已经在aurelia.json中有bootstrap引用。我尝试设置stub属性,首先将require行添加回app.html。保存ts后,应用程序现在可以正确加载。我确实根据教程构建了应用程序的其余部分,因此也进行了更改。我将重现这一点,看看是哪一步使它起作用。