问题
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