Skip to content

Configuration Options

Core Configuration Interfaces

Options (Top-level Configuration Object)

ParameterTypeRequiredDefault ValueDescription
buildBuildOptions[] | BuildOptionsYes-Configuration for build tasks (array or single object).
logLevelLogLevel (from vp-runtime-helper)No'info'Log level (e.g., 'error', 'warn', 'info').
enableBannerbooleanNofalseWhether to output a build banner (e.g., version information).

BuildOptions (Configuration for Each Build Task)

ParameterTypeRequiredDefault ValueDescription
chunkstringYes-Entry file path (relative to project root).
namestringYes'default'Global variable name (applies only to UMD/IIFE formats).
format'es' | 'cjs' | 'umd' | 'iife'No'umd'Build format (defaults to umd).
sourcemapboolean | 'inline' | 'hidden'NofalseWhether to generate sourcemaps (supports inline or hidden modes).
exports'default' | 'named' | 'none' | 'auto'No'auto'Export type for Rollup output.
minifyboolean | 'terser' | 'esbuild'NofalseWhether to enable output minification (supports terser or esbuild).
outDirstringNoMain build's outDirCustom output directory (relative to project root).
fileNamestring | ((format: string, entryName: string) => string)NoDefault based on formatCustom filename (supports template strings or functions).
pluginsPluginOption[]No[]Additional Vite plugins.

TypeScript Definitions

typescript
import { ModuleFormat } from 'rollup';
import type { LibraryFormats, PluginOption } from 'vite';
import { LogLevel } from 'vp-runtime-helper';

export interface BuildOptions {
  /**
   * The chunk name.
   */
  chunk: string;
  /**
   * Global variable name.
   */
  name: string;
  /**
   * The output format.
   */
  format?: LibraryFormats;
  /**
   * Whether to generate sourcemaps.
   */
  sourcemap?: boolean | 'inline' | 'hidden';
  /**
   * The exports type.
   */
  exports?: 'default' | 'named' | 'none' | 'auto';
  /**
   * Whether to minify the output.
   */
  minify?: boolean | 'terser' | 'esbuild';
  /**
   * The output directory.
   */
  outDir?: string;
  /**
   * The output file name.
   */
  fileName?: string | ((format: ModuleFormat, entryName: string) => string);
  /**
   * The plugins to use.
   */
  plugins?: PluginOption[];
}

export interface Options {
  /**
   * The build options.
   */
  build: BuildOptions | BuildOptions[];

  /**
   * The log level to use.
   */
  logLevel?: LogLevel;

  /**
   * Whether to output the banner
   */
  enableBanner?: boolean;
}