How to install and import paperjs for Angular 2?

China☆狼群 提交于 2019-12-22 11:07:05

问题


I tried installing paperjs by using the command

sudo npm install paper

in my angular app folder. Paper seems to appear in node_modules folder, however when I try to import it using

import { Paper } from '@paper'

it doesn't find paper module. How do I include the paper module in angular2?


回答1:


I did the following to get it working:

npm install paper --save
npm install @types/paper --save

In systemjs.comfig.js add a map for paper

map:
    ...

    'paper': 'npm:paper/dist/paper-core.js'
},

In the component

import { PaperScope, Path, Point } from 'paper';



回答2:


Following this thread there is no official typescript support yet. However, there is an unofficial typescript definition for paperJS here



来源:https://stackoverflow.com/questions/41388881/how-to-install-and-import-paperjs-for-angular-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!