Install compare-versions via npm
mainInstall the package using npm to use it in Node.js, React Native, or bundler-based web projects.
Note on Imports:
- Since v5, the main export is a named export:
import { compareVersions } from 'compare-versions'. - Since v4, the library includes an ESM version that bundlers like Webpack or Parcel will automatically select. The CJS/UMD version is located at
lib/umd/index.jsand the ESM version atlib/esm/index.js.
$ npm install compare-versions