From 6ccf595984cb37416343d3ff1708da0df3c83db6 Mon Sep 17 00:00:00 2001 From: xxx Date: Tue, 20 Feb 2024 15:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=20web-vitals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 - src/main.tsx | 6 ------ src/reportWebVitals.ts | 15 --------------- 3 files changed, 22 deletions(-) delete mode 100644 src/reportWebVitals.ts diff --git a/package.json b/package.json index 173c919..9f7af07 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "react-router-dom": "^6.9.0", "redux": "^4.2.1", "sort-by": "^1.2.0", - "web-vitals": "^3.3.0", "xlsx": "^0.18.5" }, "devDependencies": { diff --git a/src/main.tsx b/src/main.tsx index 69bb5a0..ee49cfd 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -2,7 +2,6 @@ import ReactDOM from "react-dom/client"; import "./assets/iconfont/iconfont.css"; import "./index.less"; import App from "./App"; -import reportWebVitals from "./reportWebVitals"; import { BrowserRouter } from "react-router-dom"; import { Provider } from "react-redux"; import store from "./store"; @@ -25,8 +24,3 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( ); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/src/reportWebVitals.ts b/src/reportWebVitals.ts deleted file mode 100644 index 49a2a16..0000000 --- a/src/reportWebVitals.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ReportHandler } from 'web-vitals'; - -const reportWebVitals = (onPerfEntry?: ReportHandler) => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; - -export default reportWebVitals;