I believe that the plan is to offer the ES6 build of the entire library after D3 4.0 is completed, along with a custom build generator, with which you can do this:
import { json, line } from 'd3'; json( 'file.json', ( err, data ) => ... );
(Note that there is no d3 variable when you do this - you are directly using named imports.)
Currently, the d3 package is version 3, which does not have an ES6 build, so meanwhile there are two options: install the modules you need and import them separately ...
import { json } from 'd3-request'; import { line } from 'd3-shape'; json( 'file.json', ( err, data ) => ... );
... or create your own custom assembly:
Of these, I would prefer the first - it is more explicit and, possibly, less likely to cause unused code to be in your assembly.
Rich harris
source share