File tree 1 file changed +8
-4
lines changed
packages/vite/src/node/server 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -641,14 +641,18 @@ export async function _createServer(
641
641
}
642
642
}
643
643
644
+ const normalizedPublicDir = normalizePath ( config . publicDir )
645
+
644
646
const onFileAddUnlink = async ( file : string , isUnlink : boolean ) => {
645
647
file = normalizePath ( file )
646
648
await container . watchChange ( file , { event : isUnlink ? 'delete' : 'create' } )
647
649
648
- if ( publicFiles && config . publicDir && file . startsWith ( config . publicDir ) ) {
649
- publicFiles [ isUnlink ? 'delete' : 'add' ] (
650
- file . slice ( config . publicDir . length ) ,
651
- )
650
+ if ( config . publicDir && publicFiles ) {
651
+ if ( file . startsWith ( normalizedPublicDir ) ) {
652
+ publicFiles [ isUnlink ? 'delete' : 'add' ] (
653
+ file . slice ( normalizedPublicDir . length ) ,
654
+ )
655
+ }
652
656
}
653
657
await handleFileAddUnlink ( file , server , isUnlink )
654
658
await onHMRUpdate ( file , true )
You can’t perform that action at this time.
0 commit comments