修复因端口占用导致的文件监听重复的bug

pull/1/head 0.6.2
yutent 2023-04-24 09:33:33 +08:00
parent e5a76f21ab
commit 5b3a976fd3
2 changed files with 50 additions and 48 deletions

View File

@ -295,8 +295,6 @@ export default async function createServer(root = '', conf = {}) {
PORT, PORT,
DEPLOY_PATH DEPLOY_PATH
) )
})
chokidar chokidar
.watch([SOURCE_DIR, PUBLIC_DIR, join(root, './index.html')]) .watch([SOURCE_DIR, PUBLIC_DIR, join(root, './index.html')])
.on('all', (act, filePath) => { .on('all', (act, filePath) => {
@ -333,7 +331,10 @@ export default async function createServer(root = '', conf = {}) {
} else { } else {
ws.send({ ws.send({
action: 'render', action: 'render',
data: { path: file.replace(/\\/g, '/'), content: tmp.css } data: {
path: file.replace(/\\/g, '/'),
content: tmp.css
}
}) })
} }
} }
@ -351,4 +352,5 @@ export default async function createServer(root = '', conf = {}) {
.on('ready', () => { .on('ready', () => {
ready = true ready = true
}) })
})
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "fite", "name": "fite",
"type": "module", "type": "module",
"version": "0.6.1", "version": "0.6.2",
"bin": { "bin": {
"fite": "index.js" "fite": "index.js"
}, },