I'm building an app that can load various modules (other bundles generated by different webpack configs) on demand. The BaseModule
is responsible for knowing when to load which bundle and exports some default classes like BaseUtils
. The module itself is not aware of all the possible modules/bundles it may need to load.
TestModule
is one of those modules that is loaded on demand at runtime by the BaseModule
, and TestModule
wants to use BaseUtils
.
The question is: Is it possible to require('basemodule/BaseUtils')
in TestModule
, which has its own webpack.config.js file, with BaseModule
listed as external? That is, is there a way to let the generated testmodule bundle reuse the modules available in the generated basemodule bundle? Or does BaseModule neccesarily need to be exported to global variable?