4

Is it possible to not export certain internal modules that should not be used directly by package consumers?

glennsl
  • 28,186
  • 12
  • 57
  • 75
norvana
  • 45
  • 3

1 Answers1

6

There is an undocumented option you can specify in bsconfig.json to whitelist the modules you want to export, but as I understand it, it will hide aliased modules too, and so is only useful to hide truly internal modules, and a bit error-prone since it's a whitelist. I've therefore not used it myself. But if you want to try it, you can specify "public" like this:

{
  ...
  "sources": [{
    "dir": "src",
    "public": ["ModuleA", "ModuleB"]
  }]
  ...
}

It's listed in the bsconfig.json schema, btw, with the useful comment:

Default: export all modules. It is recommended for library developers to hide some files/interfaces

glennsl
  • 28,186
  • 12
  • 57
  • 75