Max888
Max888

Reputation: 3770

Import d3 from unpkg

I would like to import d3 from unpkg.com but I am not sure which file I should be importing. What would be the unpkg equivalent of:

import * as d3 from "d3";

Upvotes: 1

Views: 904

Answers (1)

cdrini
cdrini

Reputation: 1096

This will import d3 globally:

import 'https://unpkg.com/[email protected]';

// D3 defined globally
d3.select(...);

This will import it as a module (but make a lot of network requests for each module :/)

import * as d3 from 'https://unpkg.com/[email protected]?module';

Src: https://twitter.com/unpkg/status/905239560988221440

Upvotes: 1

Related Questions