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
Ability to collect chunk info before or during renderchunk #3519
Comments
Does |
Good question indeed. Could you outline what exactly it is you need to know about the chunks? I.e. give us a rough sketch what you want to do with the chunking information? |
This is related to #3520. After grouping together translations, I want to preload translations parallel to loading a page. But also to implement something like #3009 This means that for a given chunk I need to know which dynamic imports it has, and be able to get information about the dynamic import's chunks.
|
One problem: We do not know the chunk names yet in |
This is now included in #4543 |
This issue has been resolved via #4543 as part of rollup@3.0.0-7. Note that this is a pre-release, so to test it, you need to install Rollup via |
This issue has been resolved via #4543 as part of rollup@3.0.0-8. Note that this is a pre-release, so to test it, you need to install Rollup via |
This issue has been resolved via #4543 as part of rollup@3.0.0. You can test it via |
Feature Use Case
I am writing a plugin that needs to do work in
renderChunk
, but in order to do this it has to know more about the rest of the chunk graph. For example for a given chunk's dynamic imports, it has to know their static imports. Right now I can access the dynamic imported filenames, but I have no way to acces the chunk info for this.I tried a lot of different things, for example the
augmentChunkHash
hook gives some minimal chunk information, but it's not enough.I can use
generateBundle
as a general escape hatch, but the big downside here is that it runs after any chunk optimizations such as babel and terser.Feature Proposal
I don't know enough about the rollup internals, so I'm just throwing out some ideas from a plugin writer's perspective. Of course I'm happy to learn about methods available in the existing hooks I may have overlooked!
In order of preference:
bundle
orchunks
parameter to therenderChunk
hook containing information about the other chunks. (probably with less info than ingenerateBundle
)renderChunk
giving information about the chunking graph (again with less info)this.getChunkInfo
method so that we can get the chunk based on the dynamic import idThe text was updated successfully, but these errors were encountered: