Roots Discourse

How to install 3rd party javascript library?

Sorry for this dumb question but i just cant figure it out

I am trying to install this library called '‘animate on scroll’
i installed the library using ‘yarn add aos’ and everything went fine

in main.js i imported it by typing: import ‘aos/dist/aos’

in common.js i initialized it using AOS.init(); under init(){}

however my browser still gives the error ‘aos is not defined’

what am i doing wrong here?

Please follow the instructions recommended by the library:

import AOS from 'aos';
// ...
AOS.init();

This topic was automatically closed after 42 days. New replies are no longer allowed.