简体   繁体   中英

How do I include Typed.js in an Aurelia project

I've installed it using npm . I've added it to my dependencies in aurelia.json :

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

And I've imported it into my file like so:

import Typed from 'typed';

Yet when I try to call it var typed = new Typed(...); I get a Typed is not defined exception. According to their docs things should be pretty simple so I'm not sure what I'm doing wrong.

You got some errors in your aurelia.json declaration. The dist of typed.js is located in lib and not in src and you sould define the main file. Try the following:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM