Closed jonathanstrong closed 8 years ago
If selection.transition is undefined, there’s a problem with your bundle / module loading / transpiling. You didn’t describe your transpiling process so unfortunately I can’t diagnose the issue. It looks like the bundler you are using is not correctly applying the side-effects of the d3-transition module, which adds selection.transition to the selection.prototype exported by d3-selection. Perhaps your bundler isn’t observing the module
(formerly jsnext:main
) entry point defined in the package.json?
I recommend using the default d3 bundle (d3.v4.js) during development. I’d also consider using Rollup, which does handle this sort of import correctly, as shown in the D3 Custom Bundle II example. Possibly related:
well - glad to know I wasn't just doing it wrong. importing the top-line d3 package solved the problem.
fyi the transpiling pipeline I'm using is my code is in typescript and the compiled js is bundled with the libraries with browserify. not sure what is going wrong along the way, it's hideously complicated.
while I was trying to figure this out I didn't anticipate that the imports had side effects on each other. Seems like that would be worth trying to minimize since it's error-prone and hard to debug.
Side-effects are a feature of the ECMAScript standard import statement. Rather than avoid standard features, if you want to maximize long-term user happiness, I’d file a bug with the appropriate tool to ask them to support the standard. Thank you!
I'm having a lot of trouble replicating a pattern I used many times in v3, and after extensive searching have not identified any documentation for how to do this.
the v3 version:
fyi I'm using es6 imports of specific functions from the various modules in my v4 attempts:
etc
this is the problem replicated in the console; names reflecting the transpiling process:
Then I learned about the new merge pattern, but that didn't offer any solace either.
So, how in the world do you call transition on an enter/update/exit selection? this has left me baffled. Thanks!