Skip to content

Commit

Permalink
perf: lazy import chokidar (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
9aoy authored Nov 29, 2024
1 parent c233f2d commit 1d279cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/cli/restart.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'node:path';
import chokidar from 'chokidar';
import { color, debounce, isTTY } from '../utils/helper';
import { logger } from '../utils/logger';

Expand All @@ -11,11 +10,12 @@ export async function watchFilesForRestart(
return;
}

const chokidar = await import('chokidar');

const watcher = chokidar.watch(files, {
ignoreInitial: true,
// If watching fails due to read permissions, the errors will be suppressed silently.
ignorePermissionErrors: true,
ignored: ['**/node_modules/**', '**/.git/**', '**/.DS_Store/**'],
});

const callback = debounce(
Expand Down

0 comments on commit 1d279cf

Please sign in to comment.