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

[Feature] banner and footer #482

Closed
wessberg opened this issue Oct 21, 2020 · 4 comments
Closed

[Feature] banner and footer #482

wessberg opened this issue Oct 21, 2020 · 4 comments

Comments

@wessberg
Copy link

wessberg commented Oct 21, 2020

Feature Request

I would like to propose a banner and footer option, as seen in Rollup and documented here.

A string to prepend/append to the bundle. (...) (Note: banner and footer options will not break sourcemaps).

From what I've been able to gather, and based on my own testing, the new inject option doesn't quite allow for this behavior, so I feel like this one is needed.

Use case

One common use case is for adding a license or another relevant comment in the top of a bundle in a way that doesn't break source maps.

@evanw
Copy link
Owner

evanw commented Oct 22, 2020

Yes, I think a feature like this makes sense. Another issue with --inject is that you can't insert partial files. For example, you may want the prefix to be try { and the suffix to be } finally { ... }, which may be necessary to support certain strange use cases such as hot-module reloading.

However, if I support that then these prefix and suffix strings aren't actually valid JavaScript code, and for example won't be able to be minified. I think that should be fine though since this is a very custom use case and you can always minify them yourself if needed.

@wessberg
Copy link
Author

Yes, agreed. And to your latter point, I would argue that this is fine since it would make sense that the banner and footer (or prefix and suffix if you prefer these names) are added to the bundle(s) as late in the compilation process as possible, even after minification.

@Gelio
Copy link
Contributor

Gelio commented Nov 15, 2020

I wanted to make a contribution to this project and pick up a bit of go along the way. Here is my attempt at adding support for those options: #531

@evanw
Copy link
Owner

evanw commented Nov 16, 2020

This feature was implemented in #531 by @Gelio.

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

Successfully merging a pull request may close this issue.

3 participants