mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +00:00
perf(schema): use chokidar
when a custom srcDir
is provided (#27871)
This commit is contained in:
parent
fd46d670f2
commit
ab369e1cdf
@ -330,8 +330,9 @@ export default defineUntypedSchema({
|
||||
/**
|
||||
* Set an alternative watcher that will be used as the watching service for Nuxt.
|
||||
*
|
||||
* Nuxt uses 'chokidar-granular' by default, which will ignore top-level directories
|
||||
* (like `node_modules` and `.git`) that are excluded from watching.
|
||||
* Nuxt uses 'chokidar-granular' if your source directory is the same as your root
|
||||
* directory . This will ignore top-level directories (like `node_modules` and `.git`)
|
||||
* that are excluded from watching.
|
||||
*
|
||||
* You can set this instead to `parcel` to use `@parcel/watcher`, which may improve
|
||||
* performance in large projects or on Windows platforms.
|
||||
@ -341,7 +342,18 @@ export default defineUntypedSchema({
|
||||
* @see [Parcel watcher](https://github.com/parcel-bundler/watcher)
|
||||
* @type {'chokidar' | 'parcel' | 'chokidar-granular'}
|
||||
*/
|
||||
watcher: 'chokidar-granular',
|
||||
watcher: {
|
||||
$resolve: async (val, get) => {
|
||||
if (val) {
|
||||
return val
|
||||
}
|
||||
const [srcDir, rootDir] = await Promise.all([get('srcDir'), get('rootDir')]) as [string, string]
|
||||
if (srcDir === rootDir) {
|
||||
return 'chokidar-granular'
|
||||
}
|
||||
return 'chokidar'
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Enable native async context to be accessible for nested composables
|
||||
|
Loading…
Reference in New Issue
Block a user