Skip to content

Load v3/v4 modules only when needed#439

Merged
Boshen merged 1 commit intotailwindlabs:mainfrom
Dunqing:Load-v3/v4-modules-only-when-needed
Feb 5, 2026
Merged

Load v3/v4 modules only when needed#439
Boshen merged 1 commit intotailwindlabs:mainfrom
Dunqing:Load-v3/v4-modules-only-when-needed

Conversation

@Dunqing
Copy link
Copy Markdown
Contributor

@Dunqing Dunqing commented Feb 5, 2026

Since a project will always use either v3 OR v4 (never both simultaneously), this change ensures:

  • A v3 project never loads the v4 module code
  • A v4 project never loads the v3 module code

This is particularly valuable if the version modules have different dependencies or if they're large, as you're eliminating dead code from the runtime bundle entirely.

The trade-off is minimal - a slight delay for the dynamic import() call, but this is negligible compared to the benefits and happens only once (due to the pathToApiMap caching).

@Boshen Boshen merged commit a8a6040 into tailwindlabs:main Feb 5, 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