fix(compiler): account for package imports in aliasing #5862
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.
What is the current behavior?
7ffb25d introduced a regression when generating the
components.d.ts
file. The logic for import aliasing did not account for external packages, resulting in broken import/export statements likeimport { as MyType } from 'external-package';
Fixes #5859
What is the new behavior?
The compiler will now generate a stub id for external packages so we can keep track of the original type name.
Documentation
N/A
Does this introduce a breaking change?
Testing
Verified fix on the reproduction case
Other information
This does technically change the output generated for the
docs-json
output target. Previously, the id for imports in these cases would be an empty string, now it will be a mocked id in the form of `node_modules::<type_name>'