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

Do not resolve external dynamic imports via plugins #2505

Merged
merged 3 commits into from Nov 4, 2018

Conversation

lukastaegert
Copy link
Member

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

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

Copy link
Contributor

@guybedford guybedford left a 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.

return pluginDriver.hookFirst('resolveId', [id, parent]);
return this.isExternal(id, parent, false)
? false
: pluginDriver.hookFirst('resolveId', [id, parent]);
Copy link
Contributor

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.

@lukastaegert
Copy link
Member Author

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

@lukastaegert
Copy link
Member Author

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.

@lukastaegert lukastaegert merged commit 841a536 into master Nov 4, 2018
@lukastaegert lukastaegert deleted the external-dynamic-imports branch November 4, 2018 11:43
Copy link
Contributor

@guybedford guybedford left a 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!

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