JScottWagner / d3-bundler

A Rollup-based bundler for D3 modules.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d3-bundler

A Rollup-based bundler for D3 modules.

Introduction

To install:

npm install --save-dev d3-bundler

To use, define an ES6 module that imports the D3 code you need and defines the corresponding d3 object. For example:

import {
  event,
  select,
  selectAll
} from "d3-selection";

export default {
  get event() { return event; },
  select: select,
  selectAll: selectAll
};

Make sure you have these D3 modules installed:

npm install --save d3-selection

Build your bundle:

node_modules/.bin/d3-bundler -- bundle.js > d3.js

Have a nice day!

<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="d3.js"></script>
<script>

d3.select("body").append("h1").text("Hello, world!");

</script>

Command Line Reference

d3-bundler [options] -- [file]

The input file should be an ES6 module that defines a default export object. See the examples.

Options:

  • --polyfill-map [default: false]

Include a simple polyfill for platforms that do not implement ES6 Map natively.

  • --format [default: "umd"]

Specify the output format of the generated JavaScript. See Rollup for supported values.

  • --name [default: "d3"]

Specify the name of the output module. This determines the name of the exported global in certain output formats.

About

A Rollup-based bundler for D3 modules.

License:Other


Languages

Language:JavaScript 100.0%