Skip to content
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

Output options hook #2735

Closed
Comandeer opened this issue Mar 5, 2019 · 0 comments
Closed

Output options hook #2735

Comandeer opened this issue Mar 5, 2019 · 0 comments

Comments

@Comandeer
Copy link
Contributor

Feature Use Case

Currently there is options hook that allows to customize options passed to rollup.rollup. However there is no hook for customizing options passed to bundle.generate. In some situations there is a need to override some options in plugin.

I hit such case in Comandeer/rollup-plugin-babel-minify#146. The plugin minifies given JS code and outputs banner at its beginning. The content of the banner can be passed directly to the plugin or determined from OutputOptions.banner passed to Rollup. In some rare situations the banner is inserted twice: once by the plugin and then once again by Rollup. The easiest fix for this situation would be to override OutputOptions.banner (so Rollup won't have anything to insert). At the moment is not possible; there is only banner hook, which allows to add new banner, but don't allow deleting the banner altogether.

Other case, also including banner, this time inserted before minification: #2459. Overriding banner option and inserting it by plugin after minification would solve the issue.

Feature Proposal

I propose adding outputOptions hook that will allow to override OutputOptions passed to bundle.generate:

(outputOptions: OutputOptions) => OutputOptions | null

It would be used the same way as existing options hook.

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

No branches or pull requests

1 participant