Skip to content

Commit

Permalink
perf: use package cache for one off resolve (#12744)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Apr 5, 2023
1 parent 8bef662 commit 77bf4ef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vite/src/node/config.ts
Expand Up @@ -1001,6 +1001,7 @@ async function bundleConfigFile(
dedupe: [],
extensions: DEFAULT_EXTENSIONS,
preserveSymlinks: false,
packageCache: new Map(),
}

// externalize bare imports
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/optimizer/index.ts
Expand Up @@ -867,6 +867,7 @@ function createOptimizeDepsIncludeResolver(
scan: true,
ssrOptimizeCheck: ssr,
ssrConfig: config.ssr,
packageCache: new Map(),
})
return async (id: string) => {
const lastArrowIndex = id.lastIndexOf('>')
Expand Down
2 changes: 2 additions & 0 deletions packages/vite/src/node/plugins/assetImportMetaUrl.ts
Expand Up @@ -10,6 +10,7 @@ import {
slash,
transformStableResult,
} from '../utils'
import { CLIENT_ENTRY } from '../constants'
import { fileToUrl } from './asset'
import { preloadHelperId } from './importAnalysisBuild'

Expand All @@ -33,6 +34,7 @@ export function assetImportMetaUrlPlugin(config: ResolvedConfig): Plugin {
if (
!options?.ssr &&
id !== preloadHelperId &&
id !== CLIENT_ENTRY &&
code.includes('new URL') &&
code.includes(`import.meta.url`)
) {
Expand Down

0 comments on commit 77bf4ef

Please sign in to comment.