Skip to content

Conversation

@ilyaliao
Copy link
Collaborator

Description

This PR fixes hot reload functionality when dirs is configured without wildcards.

Previously, hot reload only worked for patterns like ./composables/* or ./composables/** but failed for ./composables:

// ✅ Works (with wildcards)
dirs: ['./composables/*', './composables/**']

// ❌ Broken (without wildcards) 
dirs: ['./composables']

The issue was that picomatch couldn't properly match files against directory paths without glob patterns.

The fix normalizes directory paths using unimport's normalizeScanDirs to properly handle both wildcard and non-wildcard patterns, ensuring files are correctly matched regardless of configuration style.

As an additional optimization, it now skips hot reload checks for auto-generated config files to prevent unnecessary re-scans.

Linked Issues

resolved #583

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@antfu antfu merged commit 533d4da into unplugin:main Aug 28, 2025
6 checks passed
@ilyaliao ilyaliao deleted the fix/dirs-hot-reload-without-wildcards branch August 28, 2025 14:54
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.

Hot reload not working

2 participants