I have an agnostic application that can serve any private side developed project in a sandboxed container.
Until now, I had no issue because all 3rd party modules (or bundle) were explicitly defined in my package.json
and explicitly loaded in my code with full string value.
Like this :
import Bundle from '@company/bundle';
// ...
But now, my goal is to install and load those modules dynamically. I've already do the 'install' part, but I need to achieve this:
(async () => {
const something = ['/bundle']; // here for example but getted from a config file
for (const bundleName of something) {
const Bundle = await import(`@company${bundleName}`)
Bundle.doStuff();
}
})();
How do I achieve this ? Node js middleware ? Custom webpack plugin/loader ? bundle-loader ?