简体   繁体   English

可以在Grafana DataSource Library中导入外部JavaScript库

[英]Can import external JavaScript Libraries in Grafana DataSource Library

I am having an issue trying to import crypto-js library in a Grafana Datasource Pluging I am developing. 我正在尝试在我正在开发的Grafana Datasource Pluging中导入crypto-js库。

I get the following exception: 我得到以下异常:

Error: (SystemJS) Cannot set property 'CryptoJS' of undefined TypeError: Cannot set property 'CryptoJS' of undefined at Object.create.F ( http://localhost:3000/public/plugins/grafana-my-datasource/external/crypto-js.js?bust=1493397621246:25:20 ) at execute ( http://localhost:3000/public/plugins/grafana-my-datasource/external/crypto-js.js?bust=1493397621246:27:6 ) Error loading http://localhost:3000/public/plugins/grafana-my-datasource/module.js 错误:(SystemJS)无法设置未定义的属性'CryptoJS'TypeError:无法在Object.create.F中设置未定义的属性'CryptoJS'( http:// localhost:3000 / public / plugins / grafana-my-datasource / external / crypto-js.js?bust = 1493397621246:25:20 )执行时( http:// localhost:3000 / public / plugins / grafana-my-datasource / external / crypto-js.js?bust = 1493397621246:27:6加载http:// localhost:3000 / public / plugins / grafana-my-datasource / module.js时出错

I have this in the datasouce.js: 我在datasouce.js中有这个:

import _ from "lodash";

import moment from 'moment';

import CryptoJS from './external/crypto-js';

export class GenericDatasource {

.......

and in the Gruntfile.js: 并在Gruntfile.js中:

externals: {
  cwd: 'src',
  expand: true,
  src: ['**/external/*'],
  dest: 'dist'
}

Any ideas? 有任何想法吗?

Two things to check: 要检查两件事:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM