From a30342e0407fa352c0ce68787535b750a66784c0 Mon Sep 17 00:00:00 2001 From: Wang Guan Date: Thu, 9 May 2024 00:37:13 +0900 Subject: [PATCH] enable whyDidYouRender --- src/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index f557708..b53be11 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -45,11 +45,11 @@ dayjs.extend(localizedFormat); dayjs.extend(relativeTime); dayjs.extend(utc); dayjs.locale(locale.toLowerCase()); -// 用于检测是什么导致 re-render -// if (process.env.NODE_ENV === 'development') { -// const whyDidYouRender = require('@welldone-software/why-did-you-render'); -// whyDidYouRender(React, { trackAllPureComponents: true }); -// } +if (false && process.env.NODE_ENV === 'development') { + // 用于检测是什么导致 re-render + const {default: whyDidYouRender} = await import('@welldone-software/why-did-you-render'); + whyDidYouRender(React, { trackAllPureComponents: true }); +} // 将 Cookie 中 token 恢复到 Store const cookieToken = getToken(); if (cookieToken) {