diff --git a/frcal/src/reportWebVitals.ts b/common/src/ui/reportWebVitals.ts similarity index 89% rename from frcal/src/reportWebVitals.ts rename to common/src/ui/reportWebVitals.ts index 49a2a16..16ffde3 100644 --- a/frcal/src/reportWebVitals.ts +++ b/common/src/ui/reportWebVitals.ts @@ -1,4 +1,4 @@ -import { ReportHandler } from 'web-vitals'; +import {ReportHandler} from 'web-vitals'; const reportWebVitals = (onPerfEntry?: ReportHandler) => { if (onPerfEntry && onPerfEntry instanceof Function) { diff --git a/frcal/src/index.tsx b/frcal/src/index.tsx index 4c53ce7..11c07b2 100644 --- a/frcal/src/index.tsx +++ b/frcal/src/index.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'; import 'bootstrap/js/dist/collapse'; import './index.scss'; import App from './App'; -import reportWebVitals from './reportWebVitals'; +import reportWebVitals from '@common/ui/reportWebVitals'; import {MobileTooltipProvider} from '@common/ui/MobileTooltip'; ReactDOM.render( diff --git a/jcal/src/index.tsx b/jcal/src/index.tsx index 4c53ce7..11c07b2 100644 --- a/jcal/src/index.tsx +++ b/jcal/src/index.tsx @@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'; import 'bootstrap/js/dist/collapse'; import './index.scss'; import App from './App'; -import reportWebVitals from './reportWebVitals'; +import reportWebVitals from '@common/ui/reportWebVitals'; import {MobileTooltipProvider} from '@common/ui/MobileTooltip'; ReactDOM.render( diff --git a/jcal/src/reportWebVitals.ts b/jcal/src/reportWebVitals.ts deleted file mode 100644 index 49a2a16..0000000 --- a/jcal/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;