vite icon indicating copy to clipboard operation
vite copied to clipboard

build.chunkSizeWarningLimit options

Open mfulton26 opened this issue 6 months ago • 0 comments

Description

I'd like to specify a build.chunkSizeWarningLimit for most chunks but then specify exceptions for some other chunks. e.g. A chunk for the heic2any package is much larger than most all other chunks. I don't want my main index or other typical chunks to grow beyond a threshold but I also don't want to get warnings for known chunks that are large for which I'm accepting the risk.

Suggested solution

Change chunkSizeWarningLimit?: number to something that allows specifying a main limit with overrides by chunk name patterns like chunkSizeWarningLimit?: number | [number, Record<string, number>]

    build: {
      chunkSizeWarningLimit: [500, {
        "heic2any-*": 1500
      }],
    },

This way each chunk whose name matches specified patterns will get the associated warning limit while all other chunks will get a standard limit (in this example 500).

Alternative

No response

Additional context

No response

Validations

mfulton26 avatar May 27 '25 20:05 mfulton26