我是使用汇总来制作自定义 d3 构建的新手。我正在尝试使用d3-annotation 插件,但是构建完成后,我的控制台中出现错误:ReferenceError: d3Dispatch is not defined
在构建的文件中,似乎所有属性(如d3Dispatch
,d3Selection
等)都没有“翻译”。要求行也消失了(这可能是正常的)。
这是汇总配置文件:
import { queue } from "d3-queue";
import { event, select, selectAll } from "d3-selection";
import { scaleLinear, scaleIdentity } from "d3-scale";
import { drag } from "d3-drag";
import { json } from "d3-request";
import { annotation, annotationCalloutCircle } from "d3-svg-annotation";
export {
queue,
event,
select,
selectAll,
scaleLinear,
scaleIdentity,
drag,
json,
annotation,
annotationCalloutCircle
}
它与 gulp 任务一起使用:
gulp.task('d3-rollup', function() {
return rollup({
entry: 'js/custom.d3.js',
plugins: [
babel(),
nodeResolve({ jsnext: true }),
commonjs(),
rollup_uglify()
]
}).then(function(bundle) {
return bundle.write({
format: 'umd',
moduleName: 'd3',
dest: 'js/d3.min.js'
});
});
});
我就是不明白出了什么问题。我需要导入另一个属性吗?你有想法吗?