2017-08-28 79 views
0

我已經使用npm安裝了它。我已經將它添加到我的依賴關係aurelia.json如何在Aurelia項目中包含Typed.js

"dependencies": [ 
    // ... 
    { 
    "name": "typed", 
    "path": "../node_modules/typed.js/src" 
    } 
] 

而且我已經導入到我的文件,像這樣:

import Typed from 'typed'; 

然而,當我試圖把它var typed = new Typed(...);我得到一個Typed is not defined例外。 According to their docs事情應該很簡單,所以我不知道我做錯了什麼。

+1

您是使用TypeScript還是ES編程? –

+0

@AshleyGrant ES – Alternatex

回答

1

您在aurelia.json聲明中遇到了一些錯誤。 disttyped.js位於lib而不是src,你可以定義主文件。請嘗試以下操作:

"dependencies": [ 
    // ... 
    { 
    "name": "typed", 
    "path": "../node_modules/typed.js/lib", 
    "main": "typed" 
    } 
相關問題