2015-10-28 30 views
1

这个问题跟随在github上这个问题被关闭,因为它是不是一个错误:https://github.com/highslide-software/highcharts.com/issues/4677highcharts没有jQuery和JSPM

我想在我的项目中使用Highcharts与Highcharts适配器(避免jQuery的)。

但是,我使用JSPM构建,所以lib通常应该向jspm/registry(https://github.com/jspm/registry)提供一些信息或者说明如何去做,但是我在库论坛和堆栈中找不到任何东西溢出。

现在,我进口HighCharts这样的:(https://github.com/davinkevin/Podcast-Server/blob/jspm/public/config/config.js

... 
import HighCharts from 'highcharts-release'; 
... 

而且我已经注册它像在JSPM | SystemJS:

System.config({ 
     baseURL: "./", 
     defaultJSExtensions: true, 
     transpiler: "babel", 
     babelOptions: { 
     "optional": [ 
      "runtime", 
      "optimisation.modules.system" 
     ] 
     }, 
     paths: { 
     "github:*": "jspm_packages/github/*", 
     "npm:*": "jspm_packages/npm/*" 
     }, 
     buildCSS: true, 
     separateCSS: true, 

     map: { 
     "AngularStompDK": "github:davinkevin/[email protected]", 
     "angular": "github:angular/[email protected]", 
     "angular-animate": "github:angular/[email protected]", 
     "angular-bootstrap": "github:angular-ui/[email protected]", 
     "angular-hotkeys": "github:chieffancypants/[email protected]", 
     "angular-loading-bar": "github:chieffancypants/[email protected]", 
     "angular-mocks": "npm:[email protected]", 
     "angular-notification": "github:neoziro/[email protected]", 
     "angular-route": "github:angular/[email protected]", 
     "angular-sanitize": "github:angular/[email protected]", 
     "angular-touch": "github:angular/[email protected]", 
     "angular-truncate": "github:sparkalow/[email protected]", 
     "animate.css": "github:daneden/[email protected]", 
     "babel": "npm:[email protected]", 
     "babel-runtime": "npm:[email protected]", 
     "bootstrap-less": "github:distros/[email protected]", 
     "clean-css": "npm:[email protected]", 
     "core-js": "npm:[email protected]", 
     "css": "github:systemjs/[email protected]", 
     "font-awesome": "github:components/[email protected]", 
     "highcharts-ng": "github:pablojim/[email protected]", 
     "highcharts-release": "github:highslide-software/[email protected]", 
     "ionicons": "github:driftyco/[email protected]", 
     "lodash": "github:lodash/[email protected]", 
     "ng-file-upload": "github:danialfarid/[email protected]", 
     "ng-tags-input": "github:mbenford/[email protected]", 
     "ngstorage": "github:gsklee/[email protected]", 
     "pablojim/highcharts-ng": "github:pablojim/[email protected]", 
     "restangular": "github:mgonto/[email protected]", 
     "sockjs-client": "github:sockjs/[email protected]", 
     "stomp-websocket": "github:jmesnil/[email protected]", 
     "systemjs/plugin-text": "github:systemjs/[email protected]", 
     "text": "github:systemjs/[email protected]", 
     "videogular": "github:2fdevs/[email protected]", 
     "videogular-buffering": "github:2fdevs/[email protected]", 
     "videogular-controls": "github:2fdevs/[email protected]", 
     "videogular-overlay-play": "github:2fdevs/[email protected]", 
     "videogular-poster": "github:2fdevs/[email protected]", 
     "videogular-themes-default": "github:2fdevs/[email protected]", 
     "github:angular/[email protected]": { 
      "angular": "github:angular/[email protected]" 
     }, 
     "github:angular/[email protected]": { 
      "angular": "github:angular/[email protected]" 
     }, 
     "github:angular/[email protected]": { 
      "angular": "github:angular/[email protected]" 
     }, 
     "github:angular/[email protected]": { 
      "angular": "github:angular/[email protected]" 
     }, 
     "github:chieffancypants/[email protected]": { 
      "angular": "github:angular/[email protected]" 
     }, 
     "github:chieffancypants/[email protected]": { 
      "angular": "github:angular/[email protected]", 
      "css": "github:systemjs/[email protected]" 
     }, 
     "github:distros/[email protected]": { 
      "jquery": "github:components/[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "assert": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "buffer": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "events": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "Base64": "npm:[email protected]", 
      "events": "github:jspm/[email protected]", 
      "inherits": "npm:[email protected]", 
      "stream": "github:jspm/[email protected]", 
      "url": "github:jspm/[email protected]", 
      "util": "github:jspm/[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "https-browserify": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "os-browserify": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "path-browserify": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "process": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "stream-browserify": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "url": "npm:[email protected]" 
     }, 
     "github:jspm/[email protected]": { 
      "util": "npm:[email protected]" 
     }, 
     "github:mbenford/[email protected]": { 
      "angular": "github:angular/[email protected]", 
      "css": "github:systemjs/[email protected]" 
     }, 
     "github:mgonto/[email protected]": { 
      "angular": "github:angular/[email protected]", 
      "lodash": "npm:[email protected]" 
     }, 
     "npm:[email protected]": { 
      "fs": "github:jspm/[email protected]", 
      "module": "github:jspm/[email protected]", 
      "path": "github:jspm/[email protected]", 
      "process": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "util": "npm:[email protected]" 
     }, 
     "npm:[email protected]": { 
      "process": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "base64-js": "npm:[email protected]", 
      "ieee754": "npm:[email protected]", 
      "is-array": "npm:[email protected]" 
     }, 
     "npm:[email protected]": { 
      "buffer": "github:jspm/[email protected]", 
      "commander": "npm:[email protected]", 
      "fs": "github:jspm/[email protected]", 
      "http": "github:jspm/[email protected]", 
      "https": "github:jspm/[email protected]", 
      "os": "github:jspm/[email protected]", 
      "path": "github:jspm/[email protected]", 
      "process": "github:jspm/[email protected]", 
      "source-map": "npm:[email protected]", 
      "url": "github:jspm/[email protected]", 
      "util": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "child_process": "github:jspm/[email protected]", 
      "events": "github:jspm/[email protected]", 
      "fs": "github:jspm/[email protected]", 
      "graceful-readlink": "npm:[email protected]", 
      "path": "github:jspm/[email protected]", 
      "process": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "fs": "github:jspm/[email protected]", 
      "path": "github:jspm/[email protected]", 
      "process": "github:jspm/[email protected]", 
      "systemjs-json": "github:systemjs/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "buffer": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "fs": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "http": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "util": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "process": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "os": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "process": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "assert": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "process": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "buffer": "github:jspm/[email protected]", 
      "core-util-is": "npm:[email protected]", 
      "events": "github:jspm/[email protected]", 
      "inherits": "npm:[email protected]", 
      "isarray": "npm:[email protected]", 
      "process": "github:jspm/[email protected]", 
      "stream-browserify": "npm:[email protected]", 
      "string_decoder": "npm:[email protected]" 
     }, 
     "npm:[email protected]": { 
      "amdefine": "npm:[email protected]", 
      "process": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "events": "github:jspm/[email protected]", 
      "inherits": "npm:[email protected]", 
      "readable-stream": "npm:[email protected]" 
     }, 
     "npm:[email protected]": { 
      "buffer": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "assert": "github:jspm/[email protected]", 
      "punycode": "npm:[email protected]", 
      "querystring": "npm:[email protected]", 
      "util": "github:jspm/[email protected]" 
     }, 
     "npm:[email protected]": { 
      "inherits": "npm:[email protected]", 
      "process": "github:jspm/[email protected]" 
     } 
     } 
    }); 

但是当我加载的项目,在逻辑上也不jQuery的或适配器都存在,所以LIB停止在控制台的错误工作。

我该如何解决这个问题?

感谢

+0

解决方案是什么?你做到了吗? – Johannes

回答

1

您可以创建一个包覆盖了highcharts,你使用垫片添加highcharts适配器依赖于主highcharts文件。您可以通过this example了解如何做到这一点。

我手机上,所以我不能对此进行测试,但我认为你需要像

`{ 
    "main": "highcharts ", 
    "files": ["highcharts.js", "adapters"], 
    "shim": { 
     "highcharts": { 
      "deps": ["./adapters/standalone-framework"] 
     } 
    } 
}` 

不知道这是否是你问什么,但...

+0

我在我的主项目上做了同样的事情:https://github.com/davinkevin/Podcast-Server/blob/master/package.json#L93 –

-2

首先,你需要用JSPM命令来安装jQuery和highcharts库。

$ jspm install jquery 
$ jspm install npm:highcharts-release 

您可以在js文件中导入

import $ from 'jquery'; 
import 'highcharts-release/highcharts.js'; 
+0

我在我的文章的标题中没有指定jQuery,我想使用highcharts-adapter。 –