rsbuild-plugin-compression
    Preparing search index...

    Interface CompressionPluginOptions

    interface CompressionPluginOptions {
        algorithms?: (
            "gzip"
            | "brotli"
            | "zstd"
            | CompressionAlgorithmWithOptions
        )[];
        concurrency?: number;
        disabled?: boolean | ((ctx: { environmentName: string }) => boolean);
        exclude?: AssetFilterRules;
        include?: AssetFilterRules;
        printResult?: boolean;
        threshold?: number;
    }
    Index

    Properties

    algorithms?: ("gzip" | "brotli" | "zstd" | CompressionAlgorithmWithOptions)[]

    Compression algorithms to apply

    ["gzip", "brotli"]
    
    ["gzip", "brotli", "zstd"]
    
    [{name: "gzip", options: {level: 9}}, "zstd"]
    
    concurrency?: number

    How many assets will be compressed simultaneously

    4
    
    disabled?: boolean | ((ctx: { environmentName: string }) => boolean)

    Disable the plugin?

    false
    
    ({environmentName}) => environmentName !== "web"
    

    Compression won't be applied to the assets matching any of the provided conditions

    (asset) => asset.name.endsWith(".txt")
    
    [/\.(html|json)$/i]
    
    ["my-script", "my-html"]
    

    Compression will be applied only to the assets matching any of the provided conditions

    /\.(js|mjs|cjs|css|html|txt|xml|json|wasm|svg)$/i
    
    (asset) => asset.size > 16000 && asset.name.endsWith(".js")
    
    ["my-script", "my-html"]
    
    [/\.(js|mjs)$/i]
    
    printResult?: boolean

    Print the compression result?

    true
    
    threshold?: number

    Minimum asset size (in bytes) to apply the compression

    0