AdrianGonz97/vite-plugin-tailwind-purgecss

The plugin is very slow

baseplate-admin opened this issue · 4 comments

Hi thanks for creating this Awesome plugin,

But i have come to notice that this plugin runs a bit slow.

The entire build process for my project took over 5+ minutes.

Is there a reason as to why the plugin is this slow?

Hi @baseplate-admin, thanks for raising an issue!

This is pretty strange... I've tested this on several apps and the performance impact of the plugin shouldn't be more than a couple of percent increase in build time. In the case of your app, going from ~13 seconds -> 5 minutes is definitely unusual.

I'll look into this!

Could be the sheer size of my app :)

Its over 15 MB after building.

@baseplate-admin I've identified the issue and added a fix. The issue here is that your repo includes a massive dictionary! Given that this plugin walks the AST of the treeshaken code from Rollup and processes all string literals for selector extraction, there was a huge hold up when it got to the dictionary.

As a fix, I've added a limit to the maximum size that a string literal can be that the plugin will process.

The update will be in version 0.1.1.

Hey, thanks for quick fix. i am surprised you figured it out this fast ( congratulations )

I was wondering if this could be user configurable?