Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion packages/nuxt-cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { formatDuration } from '../utils/formatting'
import { clearBuildDir } from '../utils/fs'
import { loadKit } from '../utils/kit'
import { acquireLock, acquireOutputLock, formatLockError } from '../utils/lockfile'
import { intro, logger, outro } from '../utils/logger'
import { intro, logBlock, logger, outro } from '../utils/logger'
import { resolveRootDir } from '../utils/paths'
import { createPhaseReporter, formatPhaseBreakdown, formatPhaseTable } from '../utils/phase-reporter'
import { startCpuProfile, stopCpuProfile } from '../utils/profile'
Expand Down Expand Up @@ -118,6 +118,12 @@ export default defineCommand({
progress,
command: ctx.args.prerender ? 'generate' : 'build',
})
// Imported here rather than at the top so that commands which only load
// this file, such as `nuxt --help`, don't load the summary with it.
const { collectClientBundle, dedupeCommandFor, formatClientBundle } = await import('../utils/client-bundle')
const clientBundle = nuxt.options.logLevel === 'silent'
? undefined
: collectClientBundle(nuxt)

showBanner(nuxt)
await nuxt.ready()
Expand Down Expand Up @@ -159,6 +165,18 @@ export default defineCommand({
progress.finish()
const elapsed = Date.now() - start

const bundle = clientBundle?.()
if (bundle) {
logBlock(formatClientBundle(bundle, {
// Clack's gutter takes three columns of every row in a terminal.
columns: (process.stdout.columns || 80) - 3,
projectDir: relative(process.cwd(), nuxt.options.rootDir),
dedupeCommand: bundle.duplicates.length
? await dedupeCommandFor(nuxt.options.rootDir)
: undefined,
}))
}

const verbose = nuxt.options.logLevel === 'verbose'
const summary = nuxt.options.logLevel === 'silent'
? undefined
Expand Down
Loading
Loading