如何在基于CLI的项目中添加aurelia-animator-velocity插件?

时间:2017-07-30 19:16:40

标签: aurelia aurelia-cli

如果元素具有我配置插件的方式的“au-animate”类,则标准淡入淡出有效。但是如果app.ts注入了VelocityAnimator并且在此之后进行了新的构建,那么对于“http://localhost:9000/src/velocity.js”的HTTP GET请求失败,JS错误“未处理的拒绝错误:”速度“的脚本错误,需要:velocity -animate / velocity.ui”。

在构建输出中重复两次消息:

 ------- File not found or not accessible ------
| Location: <project folder>/src/velocity.js
| Requested by: <project folder>/src/app.js
| Is this a package? Make sure that it is configured in aurelia.json and that it is not a Node.js package

项目配置为使用Typescript。 我已经安装了npm软件包“aurelia-animator-velocity”和“velocity-animate”。我尝试包含velocity.ui,但我只想猜测如何在下面进行。

aurelia.json

{
    "name": "velocity-animate",
    "path": "../node_modules/velocity-animate",
    "main": "velocity"
},
{
    "name": "velocity-animate-ui",
    "path": "../node_modules/velocity-animate",
    "main": "velocity.ui"
},
"aurelia-animator-velocity"

main.ts

aurelia.use
    .standardConfiguration()
    .plugin('aurelia-animator-velocity')
    .feature('resources');

app.ts

import { autoinject } from "aurelia-framework";
import { VelocityAnimator } from "aurelia-animator-velocity";

@autoinject
export class App {
  constructor(private animator: VelocityAnimator) {
    console.log(this.animator);
  }
}

1 个答案:

答案 0 :(得分:0)

我找到了the workaround。另外,还有额外的字符。