How to import d3-selection and d3-selection-multi?

Title explains the question. How would you import them both and preserve the d3.* namespace?

If bundling the modules, I’d include:

  export {select, selectAll} from "d3-selection";
  export * from "d3-selection-multi";
  export * from "d3-timer";

In my index.js file, assigning one namespace to all the exports. How can I do the same with Observable when it uses something more like CJS syntax for imports?

1 Like

Seems can just use

d3 = require(
           'd3-selection',
           'd3-selection-multi'
         )

Note: @tom Might be good to add this to the require tutorial.

1 Like

Indeed - the Intro notebook overlooked that detail! Thanks for pointing it out, I’ve added a new section under “require’s input” that explains multi-requires.

1 Like