Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong resolution order for dynamically imported modules in 3.1.6 #316

Open
rproserpio opened this issue Aug 26, 2020 · 3 comments · May be fixed by #317
Open

Wrong resolution order for dynamically imported modules in 3.1.6 #316

rproserpio opened this issue Aug 26, 2020 · 3 comments · May be fixed by #317

Comments

@rproserpio
Copy link

Dynamically imported modules are sorted before any other entry since #295.

Let's assume an entry point main.js:

 import './styles.css'
 import('./dynamic.js').then(...)

and a dynamically imported module dynamic.js:

import './dynamic-styles.css`

Before #295 the css bundle had styles.css content before dynamic-styles.css content. Now the order is inverted.

The moduleIds array returned from getRecursiveImportOrder is missing the module ids found by using getModuleInfo(id).dynamicallyImportedIds. The previous definition based on this.moduleIds had them.

Dynamically imported modules should also have a stable order among themselves.

@wardpeet can I ask for your help?

@wardpeet
Copy link
Collaborator

Oh I didn't test it with dynamic ones. I'll create a fix for it. Sorry for the inconveniences

@wardpeet
Copy link
Collaborator

@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 wardpeet linked a pull request Aug 30, 2020 that will close this issue
@rproserpio
Copy link
Author

rproserpio commented Aug 30, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants