Skip to content

No error is thrown when file is not generated due to minRatio check #116

@chestozo

Description

@chestozo

Currently if the ratio of generated file size compared to original file size is greater than options.minRatio - compressed file is not being generated and no error is thrown.

Here is the check

if (result.length / originalSize > minRatio) {
  return cb();
}

https://github.com/webpack-contrib/compression-webpack-plugin/blob/master/src/index.js#L138

Expected Behavior / Situation

Error is thrown.

Actual Behavior / Situation

webpack build finishes without any trace of file not being generated (no error, no message).

Modification Proposal

Default behavior:
throw error File not generated due to file size being too big.

Add option to support current behavior. Not sure about the name for example option.dropBigFiles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions