Skip to content

Commit

Permalink
perf: remove debug only prettifyUrl call (#15204)
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Dec 1, 2023
1 parent d8001c5 commit 73e971f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,9 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
}

const ssr = options?.ssr === true
const prettyImporter = prettifyUrl(importer, root)

if (canSkipImportAnalysis(importer)) {
debug?.(colors.dim(`[skipped] ${prettyImporter}`))
debug?.(colors.dim(`[skipped] ${prettifyUrl(importer, root)}`))
return null
}

Expand Down Expand Up @@ -258,7 +257,9 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
if (!imports.length && !(this as any)._addedImports) {
importerModule.isSelfAccepting = false
debug?.(
`${timeFrom(start)} ${colors.dim(`[no imports] ${prettyImporter}`)}`,
`${timeFrom(start)} ${colors.dim(
`[no imports] ${prettifyUrl(importer, root)}`,
)}`,
)
return source
}
Expand Down Expand Up @@ -702,7 +703,7 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {
: acceptedUrls.size
? `[accepts-deps]`
: `[detected api usage]`
} ${prettyImporter}`,
} ${prettifyUrl(importer, root)}`,
)
// inject hot context
str().prepend(
Expand Down Expand Up @@ -784,7 +785,10 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin {

debug?.(
`${timeFrom(start)} ${colors.dim(
`[${importedUrls.size} imports rewritten] ${prettyImporter}`,
`[${importedUrls.size} imports rewritten] ${prettifyUrl(
importer,
root,
)}`,
)}`,
)

Expand Down

0 comments on commit 73e971f

Please sign in to comment.