Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(nuxt,schema): do not watch buildDir and node_modules #22214

Merged
merged 17 commits into from Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/nuxt/src/components/module.ts
Expand Up @@ -98,7 +98,7 @@ export default defineNuxtModule<ComponentsOptions>({
pattern: dirOptions.pattern || `**/*.{${extensions.join(',')},}`,
ignore: [
'**/*{M,.m,-m}ixin.{js,ts,jsx,tsx}', // ignore mixins
'**/*.d.ts', // .d.ts files
'**/*.d.{cts,mts,ts}', // .d.ts files
...(dirOptions.ignore || [])
],
transpile: (transpile === 'auto' ? dirPath.includes('node_modules') : transpile)
Expand Down
3 changes: 1 addition & 2 deletions packages/nuxt/src/core/builder.ts
Expand Up @@ -76,7 +76,6 @@ function createWatcher () {
ignoreInitial: true,
ignored: [
isIgnored,
'.nuxt',
'node_modules'
]
})
Expand Down Expand Up @@ -104,7 +103,7 @@ function createGranularWatcher () {
}
for (const dir of pathsToWatch) {
pending++
const watcher = chokidar.watch(dir, { ...nuxt.options.watchers.chokidar, ignoreInitial: false, depth: 0, ignored: [isIgnored] })
const watcher = chokidar.watch(dir, { ...nuxt.options.watchers.chokidar, ignoreInitial: false, depth: 0, ignored: [isIgnored, '**/node_modules'] })
const watchers: Record<string, FSWatcher> = {}

watcher.on('all', (event, path) => {
Expand Down
17 changes: 8 additions & 9 deletions packages/schema/src/config/common.ts
@@ -1,5 +1,5 @@
import { defineUntypedSchema } from 'untyped'
import { join, resolve } from 'pathe'
import { join, relative, resolve } from 'pathe'
import { isDebug, isDevelopment } from 'std-env'
import { defu } from 'defu'
import { findWorkspaceDir } from 'pkg-types'
Expand Down Expand Up @@ -352,14 +352,13 @@ export default defineUntypedSchema({
*/
ignore: {
$resolve: async (val, get) => [
'**/*.stories.{js,ts,jsx,tsx}', // ignore storybook files
'**/*.{spec,test}.{js,ts,jsx,tsx}', // ignore tests
'**/*.d.ts', // ignore type declarations
'.output',
'.git',
'.cache',
await get('analyzeDir'),
await get('buildDir'),
'**/*.stories.{js,cts,mts,ts,jsx,tsx}', // ignore storybook files
'**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}', // ignore tests
'**/*.d.{cts,mts,ts}', // ignore type declarations
'**/.{vercel,netlify,output,git,cache,data}',
'**/dist',
relative(await get('rootDir'), await get('analyzeDir')),
relative(await get('rootDir'), await get('buildDir')),
await get('ignorePrefix') && `**/${await get('ignorePrefix')}*.*`
].concat(val).filter(Boolean)
},
Expand Down