Mapping external to destructured require


I have got a library that exposes modules like that:

const { moduleA, moduleB } = require('root')

And i am trying to map it to a module, but this doesn’t work as expected through the example:

module Root = {
  type t;

  [@bs.module] external: unit => t = "root";
  [@bs.send] external: 'a => 'b => unit = "moduleA";
  [@bs.send] external:  'a => 'b => unit  = "moduleB";

How do i accomplish this? Library doesn’t expose imports like via require(root/moduleA) etc.