feat: improved sever timing

This commit is contained in:
Pooya Parsa 2020-11-21 14:55:41 +01:00
parent 04fc395149
commit dbce482b7e

View File

@ -30,7 +30,7 @@ export function timing (_opts: Options = {}): Plugin {
renderChunk (code, chunk: RenderedChunk) {
let name = chunk.fileName || ''
name = name.replace(extname(name), '')
const logName = name === 'index' ? 'entry' : name
const logName = name === 'index' ? 'Cold Start' : ('Load ' + name)
return "'use strict';" + (chunk.isEntry ? HELPER : '') + `${TIMING}.logStart('${logName}');` + code + `;${TIMING}.logEnd('${logName}');`
}
}