Skip to content

postBanner

  • Type: string | (chunk) => string | Promise<string>
  • Optional

A string to prepend to the bundle after renderChunk hook and minification.

See output.banner, output.intro as well.

Examples

Adding build info

js
import pkg from './package.json' with { type: 'json' };
import { execSync } from 'node:child_process';

const gitHash = execSync('git rev-parse --short HEAD').toString().trim();

export default {
  output: {
    minify: true,
    postBanner: `/* ${pkg.name}@${pkg.version} (${gitHash}) */`,
  },
};