Skip to content

Commit 7421998

Browse files
committed
fix: performance issues
1 parent 3acd3e1 commit 7421998

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/zenn-cli/cli/preview/index.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,12 @@ export const exec: cliCommand = async (argv) => {
2828
const srcDir = `${__dirname}/../../../.`; // refer ".next" dir from dist/cli/preview/index.js
2929
const server = await build({ port, previewUrl, srcDir });
3030
if (watch) {
31-
const watcher = chokidar.watch(process.cwd());
31+
const watcher = chokidar.watch(`${process.cwd()}/{articles,books}/**/*`);
3232
const io = socketIo(server);
33-
watcher.once("ready", () => {
33+
watcher.on("ready", () => {
3434
io.on("connection", (socket) => {
35-
watcher.once("all", async (_, path) => {
36-
if (/articles|books/.test(path)) {
37-
socket.emit("reload");
38-
}
35+
watcher.once("all", async () => {
36+
socket.emit("reload");
3937
});
4038
});
4139
});

0 commit comments

Comments
 (0)