chore: never watch node_modules (#30514)
This commit is contained in:
parent
8fc7723f22
commit
7a9fd27146
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import { chokidar } from './utilsBundle';
|
import { chokidar } from './utilsBundle';
|
||||||
import type { FSWatcher } from 'chokidar';
|
import type { FSWatcher } from 'chokidar';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
export type FSEvent = { event: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', file: string };
|
export type FSEvent = { event: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', file: string };
|
||||||
|
|
||||||
|
|
@ -51,7 +52,8 @@ export class Watcher {
|
||||||
if (!this._watchedFiles.length)
|
if (!this._watchedFiles.length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this._fsWatcher = chokidar.watch(watchedFiles, { ignoreInitial: true, ignored: this._ignoredFolders }).on('all', async (event, file) => {
|
const ignored = [...this._ignoredFolders, (name: string) => name.includes(path.sep + 'node_modules' + path.sep)];
|
||||||
|
this._fsWatcher = chokidar.watch(watchedFiles, { ignoreInitial: true, ignored }).on('all', async (event, file) => {
|
||||||
if (this._throttleTimer)
|
if (this._throttleTimer)
|
||||||
clearTimeout(this._throttleTimer);
|
clearTimeout(this._throttleTimer);
|
||||||
if (this._mode === 'flat' && event !== 'add' && event !== 'change')
|
if (this._mode === 'flat' && event !== 'add' && event !== 'change')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue