mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +00:00
perf(schema): use chokidar
when a custom srcDir
is provided (#27871)
This commit is contained in:
parent
3415241a6d
commit
c4956cbf32
@ -238,8 +238,9 @@ export default defineUntypedSchema({
|
|||||||
/**
|
/**
|
||||||
* Set an alternative watcher that will be used as the watching service for Nuxt.
|
* 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
|
* Nuxt uses 'chokidar-granular' if your source directory is the same as your root
|
||||||
* (like `node_modules` and `.git`) that are excluded from watching.
|
* 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
|
* You can set this instead to `parcel` to use `@parcel/watcher`, which may improve
|
||||||
* performance in large projects or on Windows platforms.
|
* performance in large projects or on Windows platforms.
|
||||||
@ -249,7 +250,18 @@ export default defineUntypedSchema({
|
|||||||
* @see [Parcel watcher](https://github.com/parcel-bundler/watcher)
|
* @see [Parcel watcher](https://github.com/parcel-bundler/watcher)
|
||||||
* @type {'chokidar' | 'parcel' | 'chokidar-granular'}
|
* @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
|
* Enable native async context to be accessible for nested composables
|
||||||
|
Loading…
Reference in New Issue
Block a user