Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
How to lazy load a DLL bundle? #3115
What I would like is to require.ensure a DLL bundle. I got my DLL bundle working fine, but webpack seems to expect to load it at runtime, and I havent figured out how to lazy load a DLL bundle.
I tried loading with
If I do a normal require.ensure, it works perfectly
But again, it forces webpack to rebuild the same library every time.
So how can I lazy load a DLL bundle correctly at runtime?
I tried all 6 of the options listed here and they didn't work for me. I got, "define is not defined", "module is not defined", "exports is not defined", which caused the entire app to break.
Using "var", "this", or "umd" made no difference, the app loads but still "kendo is not defined".
Can you elaborate a little more about how to configure this correctly? When I try debugging, none of the breakpoints inside my dll bundle
It seems like its not executing any of the modules, which need to set a global var
I've been trying to do something similar. After digging a bit inside the bundled DLL file, I've come to understand that DLL bundles do not execute any modules by themselves. The execution of the first module in DLL bundle is being done (in my case) inside a progressively built bundle.
I tried a diff of the bundle w/o DLL and with DLL. Here's what I found:
Bundle in normal build:
Same code in DLL bundled - manifest build:
And, somewhere in a progressively built bundle, I find this:
I've some code in module 1 that helps me dynamically load different assets for my website. But, due to this, I've implemented a nasty workaround -- to load module 1 -- that I don't like at all.
I separated the webpack runtime out of dll bundle into commons.bundle.js which is loaded before any dlls. Like this:
Is that still wrong? I thought it would take the runtime in commons and execute bundles inside dlls?