Skip to content

Commit d0e316f

Browse files
committed
fix: resolve ignoreWatch
closes #408
1 parent 91f9fa8 commit d0e316f

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

src/features/watch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function watchBuild(
3939
/[\\/]\.git[\\/]/,
4040
/[\\/]node_modules[\\/]/,
4141
options.outDir,
42-
...toArray(options.ignoreWatch),
42+
...options.ignoreWatch,
4343
],
4444
})
4545

src/options/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { resolveClean } from '../features/clean'
77
import { resolveEntry } from '../features/entry'
88
import { resolveTarget } from '../features/target'
99
import { resolveTsconfig } from '../features/tsconfig'
10-
import { resolveRegex, slash } from '../utils/general'
10+
import { resolveRegex, slash, toArray } from '../utils/general'
1111
import { createLogger } from '../utils/logger'
1212
import { normalizeFormat, readPackageJson } from '../utils/package'
1313
import type { Awaitable } from '../utils/types'
@@ -283,6 +283,14 @@ async function resolveConfig(
283283
}
284284
}
285285

286+
ignoreWatch = toArray(ignoreWatch).map((ignore) => {
287+
ignore = resolveRegex(ignore)
288+
if (typeof ignore === 'string') {
289+
return path.resolve(cwd, ignore)
290+
}
291+
return ignore
292+
})
293+
286294
const config: ResolvedOptions = {
287295
...userConfig,
288296
entry,

src/options/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,7 @@ export type ResolvedOptions = Omit<
465465
exports: false | ExportsOptions
466466
nodeProtocol: 'strip' | boolean
467467
logger: Logger
468+
ignoreWatch: Array<string | RegExp>
468469
}
469470
>,
470471
'config' | 'fromVite'

0 commit comments

Comments
 (0)