fix(misc): perf logging shouldn't be enabled twice (#23012)

This commit is contained in:
Craigory Coppola 2024-04-25 14:41:52 -04:00 committed by GitHub
parent d48fb54d56
commit c6fe9696fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,10 @@
import { PerformanceObserver } from 'perf_hooks';
if (process.env.NX_PERF_LOGGING === 'true') {
let initialized = false;
if (process.env.NX_PERF_LOGGING === 'true' && !initialized) {
initialized = true;
const obs = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
console.log(`Time for '${entry.name}'`, entry.duration);