From af9ed4ce060b8b4e6d92a1f481c08f7927a7407b Mon Sep 17 00:00:00 2001 From: "gaoyuan.1226" Date: Fri, 29 Nov 2024 11:12:06 +0800 Subject: [PATCH] fix: lazy import chokidar --- packages/core/src/cli/restart.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/cli/restart.ts b/packages/core/src/cli/restart.ts index 667393b15..934418840 100644 --- a/packages/core/src/cli/restart.ts +++ b/packages/core/src/cli/restart.ts @@ -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'; @@ -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(