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
Add API for when the build has "truly" ended #3881
Comments
I like the proposal as in contrast in previous ideas, there is a clear way how to use it in the JS API. The CLI can easily make sure the hook is called for individual runs, and I hope we can also make the watch API respect that. At that point I am only wondering about the name, In any case, a PR would definitely be welcome for this, otherwise I will hope to have a look once I am done with other things I am working on at the moment. One danger I see is that there is no mechanism that enforces users to use this, so it needs to be well-documented in the JS API section that this is something one needs to do now. On the other hand, I do not think this is a breaking change for Rollup to add this. But it will be a breaking change for plugins to support this as they can then only be used with the CLI and in environments that explicitly call this. |
I think |
#3883 has been merged now, closing. |
Feature Use Case
Currently, there is no way to know when a build has "truly" ended, and that is when there are no further calls to
generate
orwrite
, how should an external service know when to stop if its needed during build and output generation?When you run Rollup through CLI with only one output, there is no issue since we can just stop during
generateBundle
hook, but it becomes problematic when you have two or more outputs or Rollup is being called programmatically via API where output generation can happen anytime. Reopening the service to only serve output generation adds unnecessary overhead when it could just not be closed in the first placeI've thought about exposing a method in the plugin API itself that would let you manually stop its service but I consider that to be awkward to use especially if you have multiple plugins doing the same thing (Not to mention that people have their own way of naming things)
Feature Proposal
Add
end
method toRollupBundle
, which when called:end
hook in pluginsgenerate
orwrite
The
end
hook can act as a sort of cleanup for plugins, running when the build fails but not during watch mode, removing the awkward need to check for it as a way to stop the service early.Additional notes
generateBundle
and my Rollup config having two outputsThe text was updated successfully, but these errors were encountered: