getSymbolResolution: fallback to asset's symbol with non-static dependencies #7944
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.
Previously,
getSymbolResultion
would return null in a situation like this (can be caused by importingbuffer
and also using the global or using__filename
while also importingpath
manually).Now, it will fallback to the symbol that the asset declares (
asset.symbols.get("foo")
), which will work fine if the asset doesn't reexport said symbol. If if that symbol was reexported (and has the value$id1$export$id2
) then there will definitely have been a dependency with symbols and the corresponding mapping.This doesn't trigger the
Asset was skipped or not found.
assertion in the general case because many instances ofgetSymbolResolution
returning null to fallback are handled gracefully (by falling back...). But when building a library, the symbols of the entry have to be determined.This whole duplicate dependency and missing symbols problem isn't ideal, but this could also occur with two unrelated dependencies. I couldn't think of a reproduction outside of the buffer/path globals.