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
Do not resolve external dynamic imports via plugins #2505
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer the mechanism to be the same for both static and dynamic here.
I've also tried to move as much conditional hook logic out of the plugin driver as possible.
src/utils/pluginDriver.ts
Outdated
return pluginDriver.hookFirst('resolveId', [id, parent]); | ||
return this.isExternal(id, parent, false) | ||
? false | ||
: pluginDriver.hookFirst('resolveId', [id, parent]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is now duplicated with https://github.com/rollup/rollup/blob/master/src/Graph.ts#L783.
I would prefer if we could keep the separation for all calls the same I think.
@guybedford I moved the external check for dynamic imports into the default plugin handler for the resolve dynamic import hook. I guess this does make more sense though there is still some duplication between dynamic and non-dynamic import resolution. Please tell me, if this would work for you. |
Will merge this for now in its changed form as this definitely needs fixing. Feel free to add further comments to this PR if the current solution should be further improved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for following the suggestion!
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Resolve #2481
Resolve #2487 (probably)
Description
Before refactoring the plugin system, external ids would never be passed to plugin hooks for further resolution. This was broken for the resolution of dynamic imports.
This restores the old logic up to v0.64.1