Skip to content

Load compatible plugins on demand and tighten plugin detection#437

Merged
Boshen merged 1 commit intotailwindlabs:mainfrom
Dunqing:improve-compatible-plugins
Feb 4, 2026
Merged

Load compatible plugins on demand and tighten plugin detection#437
Boshen merged 1 commit intotailwindlabs:mainfrom
Dunqing:improve-compatible-plugins

Conversation

@Dunqing
Copy link
Copy Markdown
Contributor

@Dunqing Dunqing commented Feb 4, 2026

This change makes compatible plugins load lazily and conditionally. Instead of preloading all compatible plugins, we now load only those that are enabled for the current Prettier run and merge parser overrides at parse time. Plugin detection was simplified to match by name or resolved absolute path before loading. This reduces unnecessary imports and aligns compatibility checks with the active plugin list.

Benchmark shows 9% faster than before in the headlessui repo

Running benchmark comparing original vs optimized...

Benchmark 1: original
  Time (mean ± σ):      5.913 s ±  0.284 s    [User: 9.770 s, System: 0.845 s]
  Range (min … max):    5.698 s …  6.236 s    3 runs
 
Benchmark 2: optimized
  Time (mean ± σ):      5.419 s ±  0.188 s    [User: 9.068 s, System: 0.651 s]
  Range (min … max):    5.262 s …  5.627 s    3 runs
 
Summary
  optimized ran
    1.09 ± 0.06 times faster than original

@Boshen Boshen merged commit ba6c355 into tailwindlabs:main Feb 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants