I know that modules can normally be dynamically imported with the following syntax (source):
if (condition) {
import('something')
.then((something) => {
console.log(something.something);
});
}
However, the d3
library has to be imported with this syntax, not the normal import
syntax:
import * as d3 from "d3";
How do I combine the two of these to dynamically import the d3
library in an ES6 environment?