Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow default file size to ensure no big files are added later #383

Open
martinkutter opened this issue Jan 11, 2024 · 0 comments
Open

Allow default file size to ensure no big files are added later #383

martinkutter opened this issue Jan 11, 2024 · 0 comments

Comments

@martinkutter
Copy link

Do you want to request a feature or report a bug?
Bug/Feature

What is the current behavior?
It is not possible to ensure that a limit is set for each file. So over time may huge chunks are added unintentionally.
This is because files are matched multiple times and order does not matter.

Example:

assets/
  file.js (100KB)
  otherFile.js (1KB)

I want to set a limit for a specific file, and a default limit for all other files:

"bundlesize": [
        {
            "path": "./assets/file.js",
            "maxSize": "120 kB"
        },
        {
            "path": "./assets/*.js",
            "maxSize": "2 kB"
        }
    ],

But the Result ist:

PASS  ./assets/file.js: 100KB < maxSize 120KB (gzip) 
FAIL ./assets/file.js: 100KB > maxSize 2KB (gzip) 
PASS ./assets/otherFile.js: 1KB < maxSize 2KB (gzip) 

If this is a expected behaviour, may there should be an option/solution to achieve the use case.
Otherwise I suggest to do not match files multiple times based on order.

martinkutter pushed a commit to chemmedia/bundlesize that referenced this issue Jan 18, 2024
martinkutter added a commit to chemmedia/bundlesize that referenced this issue Jan 19, 2024
fix siddharthkp#383 – ensure files are not matched twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant