First you have to add Bodymovin. Bodymovin is a free extension that lets you export After Effects compositions as JSON files to embed in websites and add to apps.
npm install lottie-web
And then, in your HTML file, include the script from the dist
folder in the installed package. You could also import the library as a module from Skypack
import lottieWeb from 'https://cdn.skypack.dev/lottie-web';
N.B. : If you are getting the following error,
"Uncaught SyntaxError: Cannot use import statement outside a module"