Skip to content

optiq-image / vite

vite ​

optiq-image/vite — optimise the images in your Vite build output (bundled assets and public/ files).

Runs after the bundle is written. Every image keeps its file name and format, so references in HTML, CSS and JS stay valid; a file is only replaced when the result is smaller and meets the quality constraint.

Interfaces ​

OptiqViteOptions ​

Properties ​

PropertyTypeDescription
concurrency?numberWorker threads. Default: CPU cores − 1.
exclude?RegExp-
include?RegExpOnly files whose path (relative to outDir) matches. Default: all jpg/jpeg/png/webp/avif.
mode?CompressionModeDefault visually-lossless (SSIM ≥ 0.99, same format). PNG/GIF are only ever optimised losslessly here.
preserveMetadata?booleanKeep EXIF/XMP. Default false for build output (strips GPS etc. from published images).
verbose?booleanPrint a per-file report. Default true.

Functions ​

optiq() ​

ts
function optiq(options?): Plugin;

Parameters ​

ParameterType
options?OptiqViteOptions

Returns ​

Plugin

References ​

default ​

Renames and re-exports optiq