Open rproserpio opened 4 years ago
Oh I didn't test it with dynamic ones. I'll create a fix for it. Sorry for the inconveniences
@rproserpio Dynamic imports are tricky cause we can't determine the sequence of when they are loaded. What would you suggest we do? I can append them at the end of each pass but I don't know the exact execution order.
@wardpeet I believe that picking one of the possible execution orders and keeping it deterministically between compilations is the sound and correct strategy, since if you import a module dynamically you must already account for every possible consistent interleaving. So, according to my understanding, your PR is the right solution to this problem. Thank you.
Dynamically imported modules are sorted before any other entry since #295.
Let's assume an entry point
main.js
:and a dynamically imported module
dynamic.js
:Before #295 the css bundle had
styles.css
content beforedynamic-styles.css
content. Now the order is inverted.The
moduleIds
array returned fromgetRecursiveImportOrder
is missing the module ids found by usinggetModuleInfo(id).dynamicallyImportedIds
. The previous definition based onthis.moduleIds
had them.Dynamically imported modules should also have a stable order among themselves.
@wardpeet can I ask for your help?