5

I read this post and i want use D3.js (v4+) using only import statement like this:

import { selection } from '../node modules/d3/build/d3.js';

But, because code output is UMD (or read this) and can't import because some globals is no defined, and ES6 can't resolve absolutive names in node_modules for example and vanilla don't suport import statement without extension like this:

import * as someFeature from './myAwesomeModule';

And this is pattern to import modules and each day is growing up like you see here.

How i can use import statement without any plugin today?

Mamun
  • 66,969
  • 9
  • 47
  • 59

1 Answers1

1

You can import d3 like this:

import * as d3 from 'd3';

See more here: https://github.com/d3/d3/blob/master/README.md#installing

Emma Lewis
  • 392
  • 2
  • 6
  • 3
    Thanks for answer my question but this no work in vanilla because browser can't find module without path only with other plugin like roll-up or webpack like your link show. – Bruno Ochotorena Nov 17 '17 at 15:39