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.54k stars 1.82k forks source link

Esbuild plugin produces incorrect numbers when CSS used #360

Closed just-boris closed 6 months ago

just-boris commented 6 months ago

If a project contains a CSS file in imports, for example import "./styles.css";, size-limit with esbuild plugin only counts CSS size and skips Javascript. The same works well on webpack + webpack-css plugin.

Reproducible in this sample project: https://github.com/just-boris/size-limit-demos

The same entry produces different results when using esbuild and webpack plugins

ai commented 6 months ago

Should we suggest using webpack or there is a simple way to fix esbuild?

just-boris commented 6 months ago

Found a simple way: https://github.com/ai/size-limit/pull/361

ai commented 6 months ago

The fix was released in 11.1.2.

just-boris commented 6 months ago

Thanks, got the expected numbers now.

I think the issue is a big one. All people using @size-limit/preset-small-lib with CSS files are affected and have inaccurate numbers.

How about sending a PSA to the users?

ai commented 6 months ago

What is PSA in this context?

just-boris commented 6 months ago

Public service announcement. Something like this: https://twitter.com/justboriss/status/1771153391072292969

ai commented 6 months ago

I retweeted your tweet :)