Skip to content

Commit 26ed531

Browse files
committed
fix: dev-server watcher to use unix relativePath
1 parent b3b0885 commit 26ed531

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/dev_server.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,6 @@ export class DevServer {
430430
* @param action - Whether the file was added or deleted
431431
*/
432432
#regenerateIndex(filePath: string, action: 'add' | 'delete') {
433-
console.log({ filePath })
434433
if (action === 'add') {
435434
return this.#indexGenerator.addFile(filePath)
436435
}
@@ -702,20 +701,19 @@ export class DevServer {
702701

703702
this.#watcher.on('add', (filePath) => {
704703
const relativePath = string.toUnixSlash(filePath)
705-
const absolutePath = join(this.#cwdPath, filePath)
706-
console.log({ relativePath, absolutePath })
704+
const absolutePath = join(this.#cwdPath, relativePath)
707705
this.#hooks.runner('fileAdded').run(relativePath, absolutePath, this)
708706
})
709707
this.#watcher.on('change', (filePath) => {
710708
const relativePath = string.toUnixSlash(filePath)
711-
const absolutePath = join(this.#cwdPath, filePath)
709+
const absolutePath = join(this.#cwdPath, relativePath)
712710
this.#hooks
713711
.runner('fileChanged')
714712
.run(relativePath, absolutePath, DevServer.#WATCHER_INFO, this)
715713
})
716714
this.#watcher.on('unlink', (filePath) => {
717715
const relativePath = string.toUnixSlash(filePath)
718-
const absolutePath = join(this.#cwdPath, filePath)
716+
const absolutePath = join(this.#cwdPath, relativePath)
719717
this.#hooks.runner('fileRemoved').run(relativePath, absolutePath, this)
720718
})
721719
}

0 commit comments

Comments
 (0)