Skip to content

Add chunk ignore list for the max chunk size warning message #21276

@tiagojufr

Description

@tiagojufr

Description

I have a React app that uses Vite and MUI Data Grid. Latest version of Data Grid has an MUI fork of exceljs as a dependency that is distributed as a single minified JS file. Vite does the right thing and creates a chunk for this file, but this file alone is 1035.45 kB in the version I'm using. This of course triggers the build warning that says:

(!) Some chunks are larger than 500 kB after minification. Consider:
- Using dynamic import() to code-split the application
- Use build.rollupOptions.output.manualChunks to improve chunking: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.

Dynamic imports and manualChunks won't help here as we're talking of a single huge minified JS file. I don't want to increase chunkSizeWarningLimit because I want to make sure all my other chunks are small and under 500 kB.

Suggested solution

Vite should provide some build configuration option like ignoreChunkSize: ["exceljs.min.js"] so that it would let that chunk be bigger than 500 kB but still check the size of my other chunks.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions