Skip to content

confused about compare between bundleSize and sizeLimit #6

Description

@lebronjs

function formatBytes maybe retrun bundleSize is kb、mb、gb
but the sizeLimit must be bytes
I think they cannot compare each other because of different unit

function formatBytes(bytes, decimals = 2) {
    // ...
    return {
        bundleSize: parseFloat((bytes / Math.pow(k, i)).toFixed(dm)),
        fullSizeInfo: parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]
    }
}
messageLoggin(bundleSize, fullSizeInfo) {
        const {
            sizeLimit
        } = this.pluginOptions
        if (bundleSize < sizeLimit) {
            info("Safe:Bundle-Size", fullSizeInfo)
            this.sizeLimitSafeHandler(bundleSize)
        } 
      // ....
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions