From 4d6fee722ad9d9570f597f7320cd4970a6fd6f27 Mon Sep 17 00:00:00 2001 From: Renovate-Bot <le.rameur.94@gmail.com> Date: Thu, 25 Jul 2024 12:54:46 +0000 Subject: [PATCH] fix(deps): update dependency web-vitals to v4 --- package.json | 2 +- src/index.tsx | 7 +------ src/reportWebVitals.ts | 18 ++++-------------- yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 54f1a2c7..0dda20af 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "vite": "^5.3.5", "vite-plugin-svgr": "^4.0.0", "vite-tsconfig-paths": "^4.2.1", - "web-vitals": "^3.0.0" + "web-vitals": "^4.0.0" }, "devDependencies": { "@types/node": "^20.14.12", diff --git a/src/index.tsx b/src/index.tsx index 848d694d..3793bb03 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,13 +1,8 @@ import { createRoot } from 'react-dom/client' import App from './App' -import reportWebVitals from './reportWebVitals' +import './reportWebVitals' import './styles/index.scss' const container = document.getElementById('root') const root = createRoot(container!) root.render(<App />) - -// 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 index 57a24a21..1c7d0b94 100644 --- a/src/reportWebVitals.ts +++ b/src/reportWebVitals.ts @@ -1,15 +1,5 @@ -import { ReportHandler } from 'web-vitals' +import { onCLS, onINP, onLCP } 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 +onCLS(console.log) +onINP(console.log) +onLCP(console.log) diff --git a/yarn.lock b/yarn.lock index c414845f..de0b4b33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3815,10 +3815,10 @@ vue-eslint-parser@^9.1.0: lodash "^4.17.21" semver "^7.3.6" -web-vitals@^3.0.0: - version "3.5.2" - resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-3.5.2.tgz#5bb58461bbc173c3f00c2ddff8bfe6e680999ca9" - integrity sha512-c0rhqNcHXRkY/ogGDJQxZ9Im9D19hDihbzSQJrsioex+KnFgmMzBiy57Z1EjkhX/+OjyBpclDCzz2ITtjokFmg== +web-vitals@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-4.0.0.tgz#888b5ddb17f292673cdeb2b3ae0d6c2ff16d5e31" + integrity sha512-8wQd4jkwFRwY5q3yAmHZAJ5MjnKR1vRACK+g2OEC8nUqi0WOxBrXfOxGNlJ+QtxzzSn/TkQO58wkW0coE68n0Q== webidl-conversions@^3.0.0: version "3.0.1" -- GitLab