Skip to content

Commit

Permalink
perf: move up external url check before fs path checks (#13639)
Browse files Browse the repository at this point in the history
  • Loading branch information
suguanYang authored Oct 9, 2023
1 parent 8d18a91 commit c2ebea1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
)
}

if (isExternalUrl(resolved.id)) {
return [resolved.id, resolved.id]
}

const isRelative = url[0] === '.'
const isSelfImport = !isRelative && cleanUrl(url) === cleanUrl(importer)

Expand All @@ -348,10 +352,6 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
url = resolved.id
}

if (isExternalUrl(url)) {
return [url, url]
}

// if the resolved id is not a valid browser import specifier,
// prefix it to make it valid. We will strip this before feeding it
// back into the transform pipeline
Expand Down

0 comments on commit c2ebea1

Please sign in to comment.