2015-11-17 27 views
1

使用JSPM加载RaphaelJS的最佳方式是什么?这似乎以这样的方式出口的东西,正常的如何使用JSPM加载RaphaelJS?

jspm install raphael 

import Raphael from 'raphael'; 

不起作用。

Uncaught TypeError: Multiple defines for anonymous module 

使用JSPM/SystemJS安装和导入RaphaelJS的正确方法是什么?

回答

2

到目前为止,这似乎是唯一的解决办法:

在命令行:

jspm install [email protected] 

在源:

import 'raphael/dev/eve'; 
import 'raphael/dev/raphael.core'; 
import 'raphael/dev/raphael.svg'; 
import 'raphael/dev/raphael.vml'; 
import Raphael from 'raphael/dev/raphael.amd'; 

var paper = Raphael(10, 50, 320, 200); 
var circle = paper.circle(50, 40, 10); 

从本质上讲,我们从最新的源代码拉在master分支上的github上。但是,即使如此,仍然存在一些模块路径问题,所以我选择手动导入所有依赖项。之后,看起来很开心。

前四行的导入应该放在应用程序的引导区域的某处。实际导入的最后一行Raphael应放置在您想要实际使用的地方的模块Raphael中。

相关问题