mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-19 16:01:24 +00:00
fix(nuxt): apply ignore rules to nitro devStorage
(#31233)
This commit is contained in:
parent
1a6db8ce74
commit
0ebaa51465
@ -6,7 +6,7 @@ import { createRouter as createRadixRouter, exportMatcher, toRouteMatcher } from
|
||||
import { joinURL, withTrailingSlash } from 'ufo'
|
||||
import { build, copyPublicAssets, createDevServer, createNitro, prepare, prerender, scanHandlers, writeTypes } from 'nitropack'
|
||||
import type { Nitro, NitroConfig, NitroOptions } from 'nitropack'
|
||||
import { findPath, logger, resolveAlias, resolveIgnorePatterns, resolveNuxtModule } from '@nuxt/kit'
|
||||
import { createIsIgnored, findPath, logger, resolveAlias, resolveIgnorePatterns, resolveNuxtModule } from '@nuxt/kit'
|
||||
import escapeRE from 'escape-string-regexp'
|
||||
import { defu } from 'defu'
|
||||
import { dynamicEventHandler } from 'h3'
|
||||
@ -428,6 +428,28 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||
}),
|
||||
)
|
||||
|
||||
// Apply Nuxt's ignore configuration to the root and src unstorage mounts
|
||||
// created by Nitro. This ensures that the unstorage watcher will use the
|
||||
// same ignore list as Nuxt's watcher and can reduce unneccesary file handles.
|
||||
const isIgnored = createIsIgnored(nuxt)
|
||||
nitroConfig.devStorage ??= {}
|
||||
nitroConfig.devStorage.root ??= {
|
||||
driver: 'fs',
|
||||
readOnly: true,
|
||||
base: nitroConfig.rootDir,
|
||||
watchOptions: {
|
||||
ignored: [isIgnored],
|
||||
},
|
||||
}
|
||||
nitroConfig.devStorage.src ??= {
|
||||
driver: 'fs',
|
||||
readOnly: true,
|
||||
base: nitroConfig.srcDir,
|
||||
watchOptions: {
|
||||
ignored: [isIgnored],
|
||||
},
|
||||
}
|
||||
|
||||
// Extend nitro config with hook
|
||||
await nuxt.callHook('nitro:config', nitroConfig)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user