fix(schema): only deoptimise buildDir watcher if needed

This commit is contained in:
Daniel Roe 2023-10-31 14:08:23 +01:00
parent 98cb82ee3a
commit e2fa41030d

View File

@ -341,15 +341,20 @@ export default defineUntypedSchema({
* inside the `ignore` array will be ignored in building. * inside the `ignore` array will be ignored in building.
*/ */
ignore: { ignore: {
$resolve: async (val, get) => [ $resolve: async (val, get) => {
'**/*.stories.{js,cts,mts,ts,jsx,tsx}', // ignore storybook files const buildDir = relative(await get('rootDir'), await get('buildDir'))
'**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}', // ignore tests const shouldDeoptimiseBuildWatcher = val && Array.isArray(val) && val.some(pattern => typeof pattern === 'string' && pattern.includes('!' + buildDir))
'**/*.d.{cts,mts,ts}', // ignore type declarations
'**/.{pnpm-store,vercel,netlify,output,git,cache,data}', return [
relative(await get('rootDir'), await get('analyzeDir')), '**/*.stories.{js,cts,mts,ts,jsx,tsx}', // ignore storybook files
relative(await get('rootDir'), join(await get('buildDir'), '**/*')), '**/*.{spec,test}.{js,cts,mts,ts,jsx,tsx}', // ignore tests
await get('ignorePrefix') && `**/${await get('ignorePrefix')}*.*` '**/*.d.{cts,mts,ts}', // ignore type declarations
].concat(val).filter(Boolean) '**/.{pnpm-store,vercel,netlify,output,git,cache,data}',
relative(await get('rootDir'), await get('analyzeDir')),
shouldDeoptimiseBuildWatcher ? relative(await get('rootDir'), join(await get('buildDir'), '**/*')) : buildDir,
await get('ignorePrefix') && `**/${await get('ignorePrefix')}*.*`
].concat(val).filter(Boolean)
}
}, },
/** /**