0

ロールアップを使用してカスタム d3 ビルドを作成するのはまったく新しいことです。d3-annotation プラグインを使用しようとしていますが、ビルドが完了すると、コンソールにエラーが表示されReferenceError: d3Dispatch is not defined ます。必要な行も消えます (これはおそらく正常です)。d3Dispatchd3Selection

ロールアップ構成ファイルは次のとおりです。

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'
        });
    });
});

何が悪いのかわかりません。別のプロパティをインポートする必要がありますか? アイデアはありますか?

4

1 に答える 1