From 49300b3487ec8a057b61e29466d4595c577cd225 Mon Sep 17 00:00:00 2001 From: Jinjiang Date: Wed, 21 Feb 2024 21:29:52 +0800 Subject: [PATCH] fix: optimizeDeps.entries with literal-only pattern(s) (#15853) --- packages/vite/src/node/optimizer/scan.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/vite/src/node/optimizer/scan.ts b/packages/vite/src/node/optimizer/scan.ts index b28c13167e5fb6..60cee8e16bc0dd 100644 --- a/packages/vite/src/node/optimizer/scan.ts +++ b/packages/vite/src/node/optimizer/scan.ts @@ -20,6 +20,7 @@ import { SPECIAL_QUERY_RE, } from '../constants' import { + arraify, cleanUrl, createDebugger, dataUrlRE, @@ -239,6 +240,10 @@ function orderedDependencies(deps: Record) { } function globEntries(pattern: string | string[], config: ResolvedConfig) { + const resolvedPatterns = arraify(pattern) + if (resolvedPatterns.every((str) => !glob.isDynamicPattern(str))) { + return resolvedPatterns.map((p) => path.resolve(config.root, p)) + } return glob(pattern, { cwd: config.root, ignore: [