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
How to get information about dynamic imports in plugin context #3232
Comments
Will add this to an upcoming PR, thanks for your patience! |
Thanks, yesterday i tried to implement it myself |
What timing... This is the PR in question: #3449 |
May i ask question while you are here. Is it possible to gather source after treeshake? I mean with removed imports/exports and if some parts of not used code removed? |
Theoretically yes, but it would not be for free performance wise. We could add a getter to the return value that calculates the size on call. |
Ahh, ok. I imagined something like this. Thanks anyway. |
I might still add this in the way I described. It should not be hard to implement, it will be just another |
Yes, all wrong usage should throw ideally. It is better to be explicit that something used not right instead of silent fail. |
Ok, I decided to not add this yet as I would rather first refactor the hashing algorithm before making this available. I must admit this is not ideal, could you reopen a separate issue for making the rendered source available so that it is not forgotten? |
Thanks a lot. I will create one more |
* Do not strip JS extensions for AMD if the user returns a replacement string in resolveDynamicImport * Get rid of default plugin * Support custom rendering for dynamic imports * Add dynamic imports to getModuleInfo, resolves #3232 * Improve coverage * Add documentation * Deprecate `dynamicImportFunction` * Slightly improve performance
Documentation Is:
Please Explain in Detail...
If i use generateBundle hook, i can get
imports
anddynamicImports
for chunks. If i go deep starting to get dependency graph withthis.getModuleInfo
function - it returns onlyimportedIds
, which do not contain info about dynamic imports. It could be simplified to like:In this case i will get C->A, A->D only.
Your Proposal for Changes
Include dynamicImportedIds to this.getModuleInfo? Or somehow to get this info from chunk if it was generated because it was imported by some other place?
Thank you
The text was updated successfully, but these errors were encountered: