From 18c71dcd2556ca395bd67ca7c720c1a435268332 Mon Sep 17 00:00:00 2001 From: sun0day Date: Tue, 15 Nov 2022 23:45:55 +0800 Subject: [PATCH] fix(config): exclude config.assetsInclude empty array (#10941) fixes https://github.com/vitejs/vite/issues/10926 --- packages/vite/src/node/config.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/vite/src/node/config.ts b/packages/vite/src/node/config.ts index e90bdd7150bced..e917b5c51473f2 100644 --- a/packages/vite/src/node/config.ts +++ b/packages/vite/src/node/config.ts @@ -531,9 +531,11 @@ export async function resolveConfig( ? path.join(path.dirname(pkgPath), `node_modules/.vite`) : path.join(resolvedRoot, `.vite`) - const assetsFilter = config.assetsInclude - ? createFilter(config.assetsInclude) - : () => false + const assetsFilter = + config.assetsInclude && + (!(config.assetsInclude instanceof Array) || config.assetsInclude.length) + ? createFilter(config.assetsInclude) + : () => false // create an internal resolver to be used in special scenarios, e.g. // optimizer & handling css @imports