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

Check other chunks instead of entry one only #4

Open
tassioFront opened this issue Jul 22, 2024 · 0 comments
Open

Check other chunks instead of entry one only #4

tassioFront opened this issue Jul 22, 2024 · 0 comments

Comments

@tassioFront
Copy link

tassioFront commented Jul 22, 2024

First, thanks for that. Amazing plugin! I was about to create one when I found it. 😅

My issue looks more like a discussion, but anyway. I saw this comment regarding entry point chunks:

Note that only entry files are checked. vite-plugin-bundlesize won’t measure lazy-loaded code because that is not render blocking. Ideally this helps you focus on only meaningful metrics in regards to bundle sizes.

In the first view, I got the point, after using the plugin I'm not sure if it makes sense. Reasons:

  1. For those who use the split vendor approach: vendor chunk is not an entry point chunk, but that can become bigger, so would be really nice to follow its size;
  2. Load chunks can also become too big (controlling their size would amazing!)

Just to give you more context: I wanna use the size limit to avoid new big chunks being created (on CI). Ideally, I don't care if it is an entry file or not, because I'm thinking about the user experience of downloading big files.

ex:
image
As it shows, the vendor chunk is passing on the plugin validation. Code:

bundlesize({
      limits: [{ name: 'assets/*', limit: '20 kb' }],
    }),

Suggestion:
Guess the decision to define the type chunk limit is from the client (I mean, who is using the plugin). So, instead of also giving the responsibility to the plugin to validate entry chunks only, it could only validate by name and the client defines the rules by it. I have tested locally by removing this validation and it worked perfect: || !chunk.isEntry

That make sense?

@tassioFront tassioFront changed the title Check other chunks instead of entry fiels only Check other chunks instead of entry one only Jul 22, 2024
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