5 ms·
I think this hasn't been update since 2017, and most of it is from 2016. I pretty much only use javascript for d3, and I put it down for a while. Recently I de
by elsherbini 8y ago
I think this hasn't been update since 2017, and most of it is from 2016.
I pretty much only use javascript for d3, and I put it down for a while. Recently I decided to do something with d3 v5.0[1], and got confused about the state of ES6 modules. Has anyone gotten rollup to work with d3? Is it possible to just use ES6 modules natively in the browser if you don't care about older browsers?
My other issue was with async/await. It seems like when I used async await on a locally hosted csv file, it could take between 1 and 2 seconds to load. For my colleague sometimes minutes. When I switched to d3 v4.0 and the old callback approach, it loaded instantly, even for my colleague. What gives?
[1] https://github.com/d3/d3/blob/master/CHANGES.md https://github.com/d3/d3/blob/master/CHANGES.md
- jordan801 8y agoMost ES6 features are available in Chrome and Firefox. Not sure what the issue is with async and await, all it is, is syntactic sugar really. It shouldn't have a lag time any differently. Babel (transpiler) is super easy to setup if you have any problems with compatibility.
- daurnimator 8y agoIt's not all sugar, there are some actual differences; and especially around async/await there are optimizations that can only be made in the non-transpiled code.
- joshribakoff 8y agoHe said async/await is syntactic sugar over promises which it is. And that babel is easy to setup, which it is. Those statements are independently true. No one said the state machine that babel transpiles your async/awaits to is performant, he wasn't making that assertion. The difference between 1s & 1m lag in D3 has got to be a D3 bug.
- codetrotter 8y ago> Is it possible to just use ES6 modules natively in the browser if you don't care about older browsers? Yes. Note that you need to use <script type=module> Personally though, I am using Google Closure compiler to turn the code of all my ES6 modules into a single, packed file without modules. Additionally I have told Closure compiler to output a sourcemap so that I can debug my code still. There are some issues with this from time to time. Not sure about what the debugging story is like currently with plain ES6 modules in the browser. Here is my Makefile in case you'd like to look at the arguments I pass to Closure compiler: https://github.com/ctsrc/Infinite-Tower-Run/blob/191a4035fd188c1462979425bb3b8c638ceac438/GNUmakefile https://github.com/ctsrc/Infinite-Tower-Run/blob/191a4035fd1...