andresz1 / size-limit-action

Compare the real cost to run your JS app or lib to keep good performance in every pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compare based on pattern instead of resolved file names?

everdimension opened this issue ยท comments

I tried using this action in my project, and since bundled files have hashes in their names, they are always different (compared to files in master branch)
Because of this, the comment always shows 100% difference

Wouldn't it be better to match outputs based on the path field of .size-limit.js config?

Same issue here. Was thinking to use react-app-rewired to disable file name hashing just for this issue, hoping there's a better alternative or configuration we missed?

Screen Shot 2021-01-21 at 13 37 50

So we tried installing react-app-rewired in a test branch to see if it would fix the issue, but it's still not able to correctly display the size difference.

Screen Shot 2021-01-21 at 19 54 46

Yes! you are right! I'll try to open a PR to fix this issue

@andresz1 Thanks!! Can't wait! :)

This would be a great and useful addition!

But maybe there could be an option for reporting only the combined size of analyzed files in the GitHub comment? In the same way as in the CLI output. That would also be a perfectly fine solution for my use case. ๐Ÿ‘

Thank you for the issue! That would also help in my blog page

I currently created 8 groups under "size-limit" in my package.json:

[
    {
      "path": [
        ".next/static/chunks/*.js",
        "!.next/static/chunks/framework-*.js",
        "!.next/static/chunks/main-*.js",
        "!.next/static/chunks/polyfills-*.js",
        "!.next/static/chunks/webpack-*.js"
      ],
      "limit": "88 kB"
    },
    {
      "path": ".next/static/chunks/framework-*.js",
      "limit": "45 kB"
    },
    {
      "path": ".next/static/chunks/polyfills-*.js",
      "limit": "32 kB"
    },
    {
      "path": ".next/static/chunks/main-*.js",
      "limit": "29 kB"
    },
    {
      "path": ".next/static/chunks/pages/[slug]-*.js",
      "limit": "5 kB"
    },
    {
      "path": ".next/static/chunks/pages/search-*.js",
      "limit": "4 kB"
    },
    {
      "path": ".next/static/chunks/pages/index-*.js",
      "limit": "3 kB"
    },
    {
      "path": ".next/static/chunks/webpack-*.js",
      "limit": "2 kB"
    }
  ]

What I see at the moment is this โ€“ Beraliv/beraliv.dev#359 (comment),

Screenshot 2022-01-16 at 13 45 43

With ignorating the hash, the table would be shorter:

Path Size Loading time (3g) Running time (snapdragon) Total time
.next/static/chunks/*.js 84.76 KB (-0.39% ๐Ÿ”ฝ) 1.7 s (0%) 2.9 s (+7.71% ๐Ÿ”บ) 2.8 s
.next/static/chunks/framework-*.js 41.05 KB (0%) 821 ms (0%) 360 ms (+3.39% ๐Ÿ”บ) 1.2 s
.next/static/chunks/polyfills-*.js 30.29 KB (0%) 606 ms (0%) 703 ms (-30.62% ๐Ÿ”ฝ) 1.4 s
.next/static/chunks/main-*.js 28.42 KB (-4.85% ๐Ÿ”ฝ) 598 ms (0%) 1.2 s (+62.99% ๐Ÿ”บ) 875 ms
.next/static/chunks/pages/[slug]-*.js 4.34 KB (0%) 87 ms (0%) 330 ms (+25.42% ๐Ÿ”บ) 417 ms
.next/static/chunks/pages/search-*.js 3.17 KB (0%) 64 ms (0%) 175 ms (+18.64% ๐Ÿ”บ) 238 ms
.next/static/chunks/pages/index-*.js 2.57 KB (0%) 52 ms (0%) 242 ms (-0.09% ๐Ÿ”ฝ) 293 ms
.next/static/chunks/webpack-*.js 1.6 KB (0%) 33 ms (+3% ๐Ÿ”บ) 207 ms (+81.73% ๐Ÿ”บ) 240 ms

Yes! you are right! I'll try to open a PR to fix this issue

@andresz1 are you still interested in fixing this? I can look into the code and try to open a PR if so.