diff --git a/packages/vite/src/node/plugins/importAnalysis.ts b/packages/vite/src/node/plugins/importAnalysis.ts index 85ef2835be1ea0..b48afa859314cf 100644 --- a/packages/vite/src/node/plugins/importAnalysis.ts +++ b/packages/vite/src/node/plugins/importAnalysis.ts @@ -41,7 +41,7 @@ import { makeLegalIdentifier } from '@rollup/pluginutils' import { shouldExternalizeForSSR } from '../ssr/ssrExternal' const isDebug = !!process.env.DEBUG -const debugRewrite = createDebugger('vite:rewrite') +const debug = createDebugger('vite:import-analysis') const clientDir = normalizePath(CLIENT_DIR) @@ -105,11 +105,11 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { const prettyImporter = prettifyUrl(importer, root) if (canSkip(importer)) { - isDebug && debugRewrite(chalk.dim(`[skipped] ${prettyImporter}`)) + isDebug && debug(chalk.dim(`[skipped] ${prettyImporter}`)) return null } - const rewriteStart = Date.now() + const start = Date.now() await init let imports: readonly ImportSpecifier[] = [] // strip UTF-8 BOM @@ -140,10 +140,8 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { if (!imports.length) { isDebug && - debugRewrite( - `${timeFrom(rewriteStart)} ${chalk.dim( - `[no imports] ${prettyImporter}` - )}` + debug( + `${timeFrom(start)} ${chalk.dim(`[no imports] ${prettyImporter}`)}` ) return source } @@ -510,6 +508,13 @@ export function importAnalysisPlugin(config: ResolvedConfig): Plugin { } } + isDebug && + debug( + `${timeFrom(start)} ${chalk.dim( + `[${importedUrls.size} imports rewritten] ${prettyImporter}` + )}` + ) + if (s) { return s.toString() } else {