Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

bundle plugin hook is not called when module is rolled up in a build #517

Closed
adamburgess opened this issue Mar 3, 2016 · 4 comments
Closed

Comments

@adamburgess
Copy link
Contributor

I'm not sure if this is by design or simply just unsupported with rollup, but I'd like to be able to run some steps in this hook.

alternatively, provide a means of getting compileOpts into the other hooks, so I can, for example, determine whether I'm making a static build/bundle, build for node/browser, and probably more things.
can you do this? or would you not want to do that as it doesn't follow the spec?

@guybedford
Copy link
Member

Could you share what sorts of optimizations you would like to be making here?

@guybedford guybedford added the bug label Mar 12, 2016
@guybedford
Copy link
Member

This is definitely a bug and should be supported. Implementation notes below.

The native solution is to add an inlined array to the load records, but that doesn't cater to the whole-tree optimization case.

Perhaps we just need to split this into the two cases (i) where the inline records are manually run through the bundle hook for whole-tree optimization (abstracting the bundle hook into a unified shared method) and (ii) where the inline records need to be shared with a larger tree, accepting an existing list of "bundleLoads" into compileTree even when that might not intersect with the tree at all. This should also include assetList actually.

@adamburgess
Copy link
Contributor Author

sorry for not getting back to you on use cases...

One example I had thought up was including a dependency like jquery normally in a bundle (for fast dev loading), but then for builds you'd instead return window.jQuery and manage loading jquery from a cdn

@guybedford
Copy link
Member

Released in 0.15.24.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants