I encountered issues when installing and using react-timeago in my Vite + React project.
Installation Command Used:
npm install react-timeago@latest
Warnings During Installation:
npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated [email protected]: This package is no longer supported.
npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm WARN deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm WARN deprecated [email protected]: This package is no longer supported.
npm WARN deprecated [email protected]: This package is no longer supported.
Error in Vite When Importing react-timeago:
[plugin:vite:import-analysis] Missing "./lib/language-strings/fr" specifier in "react-timeago" package
C:/xampp/htdocs/my_code/src/components/Dropdown.jsx:7:26
23 | import frenchStrings from "react-timeago/lib/language-strings/fr";
Code Causing the Issue:
import ReactTimeAgo from 'react-timeago';
import frenchStrings from 'react-timeago/lib/language-strings/fr';
import buildFormatter from 'react-timeago/lib/formatters/buildFormatter';
const formatter = buildFormatter(frenchStrings);