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
Improve id resolution #2829
Merged
Merged
Improve id resolution #2829
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…oints and manual chunks
points and introducing a manualChunkAlias for colouring to resolve this confusing double use of chunkAlias
* Allow manual chunks to contain entry points without name or with the same name * Throw if an emitted chunk is not found * Throw if there is a conflict between manual chunk entries * Allow nesting of manual chunks without requiring a specific order
- if the alias matches, the manual chunk becomes the entry chunk - otherwise a facade is created
function to `emitChunk`
# Conflicts: # docs/05-plugins.md # src/Chunk.ts # src/ModuleLoader.ts # src/rollup/types.d.ts # src/utils/assetHooks.ts # src/utils/defaultPlugin.ts # src/utils/error.ts # src/utils/pluginDriver.ts # test/function/samples/emit-chunk/chunk-not-found/_config.js
lukastaegert
force-pushed
the
improve-id-resolution
branch
from
May 3, 2019 05:01
883878a
to
131ed0f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Resolves #2811
Description
This cleans up, refactors, fixes and extends the resolution of static and dynamic module ids.
It includes:
Fix existing
this.resolveId
plugin context functionBefore when plugins returned
false
or the new object form in their resolveId hook, this function would also returnfalse
or an object. This is changed now in that this utility function will now always return the resolved id as a string ornull
if the id cannot be resolved. The documentation is adjusted as well.Add new
this.resolve
plugin context function and markthis.resolveId
andthis.isExternal
as deprecated in the documentation.With the new object form, there are some situations that are very hard to manage via the existing utility functions. Most notably,
this.isExternal
did not take ids into account that were marked as "external" by plugins.To that end, there now is a new
this.resolve(source, importer): Promise({id: string, external: boolean})
utility function that resolves to an object and can be used to replace boththis.resolveId
andthis.isExternal
.The old hooks have only been marked as deprecated in the documentation for now. I made notes here https://github.com/rollup/rollup/projects/2 and here https://github.com/rollup/rollup/projects/3 to deprecate and remove them in the next major versions.
Refine
resolveDynamicImport
hookThe hook has been refined in several important aspects and the documentation has been updated accordingly:
this.resolveId
:null
, the specifier is passed to the normalresolveId
hook (existing behaviour){id, external}
object which will always be treated as a module reference (NEW). This allows resolving truly dynamic imports to modules in the graph.