mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat(vite): display production build stats (#9761)
This commit is contained in:
parent
04c8625843
commit
faf260757c
@ -3,7 +3,7 @@ import { resolve, join } from 'pathe'
|
||||
import { createNitro, createDevServer, build, prepare, copyPublicAssets, writeTypes, scanHandlers, prerender } from 'nitropack'
|
||||
import type { NitroConfig, Nitro } from 'nitropack'
|
||||
import type { Nuxt } from '@nuxt/schema'
|
||||
import { resolvePath } from '@nuxt/kit'
|
||||
import { logger, resolvePath } from '@nuxt/kit'
|
||||
import escapeRE from 'escape-string-regexp'
|
||||
import defu from 'defu'
|
||||
import fsExtra from 'fs-extra'
|
||||
@ -202,7 +202,9 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) {
|
||||
await copyPublicAssets(nitro)
|
||||
await prerender(nitro)
|
||||
if (!nuxt.options._generate) {
|
||||
logger.restoreAll()
|
||||
await build(nitro)
|
||||
logger.wrapAll()
|
||||
} else {
|
||||
const distDir = resolve(nuxt.options.rootDir, 'dist')
|
||||
if (!existsSync(distDir)) {
|
||||
|
@ -18,7 +18,9 @@ export default defineUntypedSchema({
|
||||
mode: {
|
||||
$resolve: async (val, get) => val ?? (await get('dev') ? 'development' : 'production')
|
||||
},
|
||||
logLevel: 'warn',
|
||||
logLevel:{
|
||||
$resolve: async (val, get) => val ?? (await get('dev') ? 'warn' : 'info')
|
||||
},
|
||||
define: {
|
||||
$resolve: async (val, get) => ({
|
||||
'process.dev': await get('dev'),
|
||||
|
@ -151,7 +151,9 @@ export async function buildClient (ctx: ViteBuildContext) {
|
||||
// Build
|
||||
logger.info('Building client...')
|
||||
const start = Date.now()
|
||||
logger.restoreAll()
|
||||
await vite.build(clientConfig)
|
||||
logger.wrapAll()
|
||||
await ctx.nuxt.callHook('vite:compiled')
|
||||
logger.success(`Client built in ${Date.now() - start}ms`)
|
||||
}
|
||||
|
@ -138,7 +138,9 @@ export async function buildServer (ctx: ViteBuildContext) {
|
||||
if (!ctx.nuxt.options.dev) {
|
||||
const start = Date.now()
|
||||
logger.info('Building server...')
|
||||
logger.restoreAll()
|
||||
await vite.build(serverConfig)
|
||||
logger.wrapAll()
|
||||
// Write production client manifest
|
||||
await writeManifest(ctx)
|
||||
await onBuild()
|
||||
|
Loading…
Reference in New Issue
Block a user