question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

use specific D3 ES6 modules?

See original GitHub issue

Instead of import * as d3 from 'd3'; we can import the specific D3 functions and/or modules we are using.

This ought to cut down bundle sizes. It’s a big task though!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kum-deepakcommented, Oct 30, 2019

I have been reading the rollup documentation and plugin system. It has quite a lot of goodies.

It should be possible that in our sources we use specific imports, but for some of the release versions we can rewrite it to d3.

I am currently modifying the stocks sample to use different models - a rollup generated bundle, directly module etc. I will publish these as an experimental PR for our discussion.

1reaction
kum-deepakcommented, Oct 19, 2019

As preparation utils.add and utils.subtract need to be updated to not use d3[funcName] to call a function. I will create a separate PR for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

es6 module import of d3 4.x fails - Stack Overflow
It turns out d3 uses package.json to allow it to export two formats from a single source, npm itself. To do so, it...
Read more >
es6 import syntax example? #20 - d3/d3-collection - GitHub
I think that there's should be an example on the Readme for how to import the library using the es6 import syntax.
Read more >
Creating Data Visualization with D3: Using D3 with ES6
D3 : Bar Chart using CSV · JavaScript ES6 Modules · Swift Programming Tutorial for Beginners (Full Tutorial) · Data Layer in Google...
Read more >
D3 is now modular - Medium
Modularity means a lot of different things. In the D3 world, it has some specific meaning. Here are some notes from a D3...
Read more >
Using and bundling individual D3 modules - Derek Swingley
I tweaked the original to use individual modules via script tags referencing d3js.org. Here's a bl.ock showing that.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found