Fix dynamic import of modules with inlined imports #8648
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
↪️ Pull Request
When dynamically importing a module that itself has an inlined import (e.g. with bundle-text) a module loader is added for the inlined bundle, which references a file that is not generated (since it is inlined). This invalid reference causes the import to fail at runtime if the fetch fails before the correct import resolves; it appears to also cause a TypeError ("Cannot read properties of undefined") in tests.
This fix simply excludes external bundles in getLoaderRuntime that have a bundleBehavior of inline.
💻 Examples
From the unit test code:
asyncTransitive.js
:inline.js
:inline.html
:asyncTransitive.js
is used as an entry point; generates 2 invalid references:(
inline.4243f809.js
andinline.0dc63d1b.html
don't exist)🚨 Test instructions
N/A (unit test added)
✔️ PR Todo