Skip to content

Commit 77bf4ef

Browse files
authored
perf: use package cache for one off resolve (#12744)
1 parent 8bef662 commit 77bf4ef

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

packages/vite/src/node/config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@ async function bundleConfigFile(
10011001
dedupe: [],
10021002
extensions: DEFAULT_EXTENSIONS,
10031003
preserveSymlinks: false,
1004+
packageCache: new Map(),
10041005
}
10051006

10061007
// externalize bare imports

packages/vite/src/node/optimizer/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ function createOptimizeDepsIncludeResolver(
867867
scan: true,
868868
ssrOptimizeCheck: ssr,
869869
ssrConfig: config.ssr,
870+
packageCache: new Map(),
870871
})
871872
return async (id: string) => {
872873
const lastArrowIndex = id.lastIndexOf('>')

packages/vite/src/node/plugins/assetImportMetaUrl.ts

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
slash,
1111
transformStableResult,
1212
} from '../utils'
13+
import { CLIENT_ENTRY } from '../constants'
1314
import { fileToUrl } from './asset'
1415
import { preloadHelperId } from './importAnalysisBuild'
1516

@@ -33,6 +34,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
3334
if (
3435
!options?.ssr &&
3536
id !== preloadHelperId &&
37+
id !== CLIENT_ENTRY &&
3638
code.includes('new URL') &&
3739
code.includes(`import.meta.url`)
3840
) {

0 commit comments

Comments
 (0)