From 886cca19ea5128c260fbd027616e61912f9dc4e6 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 15 Mar 2023 11:26:01 +0000 Subject: [PATCH] fix(kit): provide name to `performance.mark()` (#19687) --- packages/kit/src/module/define.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/kit/src/module/define.ts b/packages/kit/src/module/define.ts index 2a2ac6f9fe..0372aed75e 100644 --- a/packages/kit/src/module/define.ts +++ b/packages/kit/src/module/define.ts @@ -68,9 +68,10 @@ export function defineNuxtModule (definition: Mo } // Call setup - const mark = performance.mark() + const key = `nuxt:module:${uniqueKey || (Math.round(Math.random() * 10000))}` + const mark = performance.mark(key) const res = await definition.setup?.call(null as any, _options, nuxt) ?? {} - const perf = performance.measure(`nuxt:module:${uniqueKey || (Math.round(Math.random() * 10000))}`, mark.name) + const perf = performance.measure(key, mark.name) const setupTime = Math.round((perf.duration * 100)) / 100 // Measure setup time