Looks like something (Babylon most likely) inserts "use strict"; to the beginning of the D3 script file or merges it into another file with the words "use strict" at the top. This means that this in a global scope (or in a function called without a defined this ) is no longer a reference to a global object, but undefined . (Considering that in the "free" mode or in a function that does not have this special meaning, this in the global scope is a reference to the global object, which is also accessible through the global variable `window1.)
You need to remove your d3.js from the list of scripts converted by Babel and just enable it as is. Assuming you are using a regular d3.js file, it looks like this:
!function() { var d3 = { version: "3.5.16" }; var d3_arraySlice = [].slice, d3_array = function(list) { return d3_arraySlice.call(list); }; var d3_document = this.document; // ... // ... // ...lots of stuff here... // ... // ... }();
It depends on starting in free mode.
Tj crowder
source share