diff --git a/src/cli/serve/serve.js b/src/cli/serve/serve.js index ed05bcaf38ffb..cc592d53230bc 100644 --- a/src/cli/serve/serve.js +++ b/src/cli/serve/serve.js @@ -13,10 +13,12 @@ import { resolve } from 'path'; import url from 'url'; import { getConfigPath } from '@kbn/utils'; +import { REPO_ROOT } from '@kbn/dev-utils'; import { IS_KIBANA_DISTRIBUTABLE } from '../../legacy/utils'; -import { fromRoot } from '../../core/server/utils'; import { readKeystore } from '../keystore/read_keystore'; +const fromRoot = (p) => resolve(REPO_ROOT, p); + function canRequire(path) { try { require.resolve(path); diff --git a/src/dev/cli_dev_mode/get_server_watch_paths.ts b/src/dev/cli_dev_mode/get_server_watch_paths.ts index 46aa15659a513..53aa53b5aa63a 100644 --- a/src/dev/cli_dev_mode/get_server_watch_paths.ts +++ b/src/dev/cli_dev_mode/get_server_watch_paths.ts @@ -47,15 +47,7 @@ export function getServerWatchPaths({ pluginPaths, pluginScanDirs }: Options) { ...pluginScanDirs, ].map((path) => Path.resolve(path)) ) - ); - - for (const watchPath of watchPaths) { - if (!Fs.existsSync(fromRoot(watchPath))) { - throw new Error( - `A watch directory [${watchPath}] does not exist, which will cause chokidar to fail. Either make sure the directory exists or remove it as a watch source in the ClusterManger` - ); - } - } + ).filter((path) => Fs.existsSync(fromRoot(path))); const ignorePaths = [ /[\\\/](\..*|node_modules|bower_components|target|public|__[a-z0-9_]+__|coverage)([\\\/]|$)/,