【发布时间】:2017-01-30 14:14:10
【问题描述】:
我需要在 angular2 项目中导入第 3 方库。
这是我所做的:
ng new myproject
npm install --save createjs-easeljs
npm install @types/easeljs
现在是我陷入困境的时刻。如何导入和使用这个库?有Shape或Stage之类的对象
import { Shape, Stage } from '../../../node_modules/createjs-easeljs/lib/easeljs-0.8.2.min.js';
这根本不起作用。
我的文件夹结构:
dynam194:src timo$ tree -L 2
.
├── app
│ ├── app.component.css
│ ├── app.component.html
│ ├── app.component.spec.ts
│ ├── app.component.ts
│ ├── app.module.ts
│ └── canvas
├── assets
├── environments
│ ├── environment.prod.ts
│ └── environment.ts
├── favicon.ico
├── index.html
├── main.ts
├── polyfills.ts
├── styles.css
├── test.ts
├── tsconfig.json
└── typings
└── easeljs.d.ts
tsconfig.json
"paths": {
"easeljs": ["../node_modules/createjs-easeljs/lib/easeljs-0.8.2.min.js"]
},
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types",
"typings",
]
【问题讨论】:
标签: javascript angular typescript angular-cli