ai / size-limit

Calculate the real cost to run your JS app or lib to keep good performance. Show error in pull request if the cost exceeds the limit.
MIT License
6.56k stars 1.82k forks source link

size-limit fails to detect paths/files containing unescaped characters #369

Closed byronhulcher closed 3 months ago

byronhulcher commented 3 months ago

I am working in a next.js project with a page at path /pages/[...rest.tsx] which follows next's guidance for catch-alls

However when running size-limit on the build artifact from my project I get an error like

  /[...rest]
  Size Limit can’t find files at build/static/chunks/pages/[...rest]-ad704487c50fb012.js

I believe this is due to how size limit is calling globby. globby (more specifically, fast-glob) expects you to escape your paths before passing them over. fast-glob even provides a helper for this.

I believe that passing all of the paths through this function will fix this issue, in fact I have tested it locally and will file a PR. I am optimistic we can solve this together 🙂

ai commented 3 months ago

Escaping ! will mean that users will not be able to use glob features. So I think it is on user to escape patterns if they do not need to use glob feature.