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 relative external ids when using the object form #2907

Merged
merged 2 commits into from Jun 9, 2019

Conversation

lukastaegert
Copy link
Member

@lukastaegert lukastaegert commented Jun 9, 2019

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:
Resolves #2867

Description

This change will improve the behaviour of the resolveId hook so that the user has the option to specify external ids that will appear in the generated bundle unmodified even in the case of relative imports. This also contains a documentation update that explains this.

The logic is now:

  • if a relative import is marked as external via user option or by returning "false" from the "resolveId" hook, Rollup will internally resolve the import to an absolute file system location to be able to merge different relative imports of the same external file. When the bundle is written, the absolute location will be converted to a relative import again as if the "output.file" or "output.dir" option were in the same location as the entry point (or the common base directory of all entry points) (existing behaviour).
  • if "resolveId" returns an object with an absolute id and "external: true", this id will be resolved to a relative import in the generated bundle (existing behaviour).
  • if "resolveId" returns an object with a relative id and "external: true", this id will not be resolved but used in the generated bundle unmodified (new behaviour)

@lukastaegert lukastaegert force-pushed the gh-2867-do-not-resolve-object-external branch from 2b8d0f4 to 8d33669 Compare June 9, 2019 15:01
@lukastaegert lukastaegert merged commit fd2fe29 into master Jun 9, 2019
@lukastaegert lukastaegert deleted the gh-2867-do-not-resolve-object-external branch June 9, 2019 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

resolveId rewrites local ids without an escape hatch
1 participant