I want to use locomotive.js on my project and have installed it on vscode (npm install locomotive-scroll) and have even followed this tutorial:
https://www.youtube.com/watch?v=zrM6N-G6U_M&list=PLNf1MNtmy_vyQkFjuNqxKpQT0U_rbC_y8&index=19
My problem is that I get an error saying:
Uncaught SyntaxError: Cannot use import statement outside a module
I have no idea what to do. I have done some research on compilers and stuff like that but I don't think the tutorial mentioned any of that. It was literally: install, copy, paste and you're good to go.
Here's the script:
import LocomotiveScroll from 'locomotive-scroll';
const scroll = new LocomotiveScroll({
el: document.querySelector('[data-scroll-container]'),
smooth: true
});
and to link it to my html:
<script src="index.js"></script>
Any help or ideas would be appreciated.