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

Parametrize output.banner/output.footer #3398

Closed
stropho opened this issue Feb 24, 2020 · 5 comments · Fixed by #4543 or #4549
Closed

Parametrize output.banner/output.footer #3398

stropho opened this issue Feb 24, 2020 · 5 comments · Fixed by #4543 or #4549

Comments

@stropho
Copy link

stropho commented Feb 24, 2020

Feature Use Case

Prepend//append different content to different entry points.
At the moment e.g. the banner could be string | (() => string | Promise<string>). In case of a function, it would be great to have some idea which entry point are we working with in order to resolve correct content and insert it to the code file.

This is obviously useful only when working with multiple entry points, i.e. input is of type { [entryName: string]: string }

In my case, I'd use it for some of those standalone JSDoc such as @module which seem to disappear in the output generated from rollup.

Feature Proposal

banner/footer function will have some more information in its parameters.
It could be the value pair from input map.
It could be the placeholders' values used in output.entryFileNames
It could have more output chunk information ?
It could something else.

I'd go with the easiest choice, not sure which one it is.

@lukastaegert
Copy link
Member

Sounds useful but it is not a small change as this will also have some impact on hash generations. At the moment, the algorithm makes use of the fact that it does not change.

Still keeping this as a future improvement.

For the time being, you could manually insert banners in the renderChunk hook, which has all this information available.

@lukastaegert
Copy link
Member

This feature will be included in #4543

@rollup-bot
Copy link
Collaborator

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 npm install rollup@3.0.0-7 or npm install rollup@beta. It will likely become part of a regular release later.

@rollup-bot
Copy link
Collaborator

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 npm install rollup@3.0.0-8 or npm install rollup@beta. It will likely become part of a regular release later.

@rollup-bot
Copy link
Collaborator

This issue has been resolved via #4543 as part of rollup@3.0.0. You can test it via npm install rollup.

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