Hacker News new | ask | show | jobs
by astashov 1923 days ago
I switched my pet project (about 15000 lines of code) from Webpack to esbuild, and reduced the build time from 30 seconds to 2 seconds.

The trickiest part was to make Tailwind CSS work. I used to do that via postcss plugin, but just running that plugin even without Webpack takes 15 seconds. Finally, with some modifications in my CSS I made it work, and purged the unused styles just by using PurgeCSS API manually.

The setup got a bit hairier than with Webpack, but it builds damn fast now.

2 comments

I believe the Tailwind team are currently working on addressing the performance issues. The project lead was recently tweeting about the new approach [0]; instead of building a huge CSS file and stripping out the unused classes, the new version will only generate the used classes to begin with.

[0] https://twitter.com/adamwathan/status/1366514152517337089

Mind sharing some details? I've been working on this myself and I don't have much JS ecosystem experience. I found the same issue around using tailwindcss as a postcss plugin (it basically tripled my build time), so would love to hear alternative solutions.