How to solve the definition of dependences with lazy loading js module (file)?

128 views Asked by At

I have TypeScript with External modules (ES6 modules), that is resolved and compiled by the webpack and ts-loader in es5 bundle.

And also I have separate modules (usually it's file with class), which may extend, patch and add functionality to main bundle, so these separate modules import dependencies from main bundle.

BUT, these separate modules can be created any time and get to the server any anytime (compiled .js --> upload --> server) so main bundle doesn't know anything about them.

How to implement this? Require.ensure unsuitable, forwarding all the dependencies from window very uncomfortable, including for developing.

P.S.: Previously, the problem was solved very simply by Internal modules (global namepsaces) and concatenating files in bundle. Any module(object) was available from the window, so by native lazy loading (ajax script) could extend, patch and add functionality to bundle.

1

There are 1 answers

0
m1neral On BEST ANSWER

DllPlugin / DllReferencePlugin + NamedModulesPlugin