I am currently facing a challenge in my angular2 project where I need to import a 3rd party library.
Here are the steps I have taken so far:
ng new myproject
npm install --save createjs-easeljs
npm install @types/easeljs
However, I am stuck at this point. How do I go about importing and utilizing this library? Some of the objects in the library include Shape
and Stage
.
import { Shape, Stage } from '../../../node_modules/createjs-easeljs/lib/easeljs-0.8.2.min.js';
Unfortunately, this method does not seem to work.
This is how my folder structure looks like:
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",
]