I am trying to use Shepard.js for my web app.
I have installed the package using:
npm install shepherd.js --save
And I can see the folder in the node_modules folder in my web app's directory:
/Users/xxx/Desktop/Coding/anybody/anybody1/node_modules/shepherd.js
I have also checked I have node.js installed which I do.
When I try to follow the usage part of the Shepard Docs and add it to my js file I get this error:
Uncaught SyntaxError: Cannot use import statement outside a module
Here is how I have added it to my .js file:
import Shepherd from 'shepherd.js';
const tour = new Shepherd.Tour({
defaultStepOptions: {
classes: 'shadow-md bg-purple-dark',
scrollTo: true
}
});
tour.addStep({
id: 'example-step',
text: 'This step is attached to the bottom of the <code>.example-css-selector</code> element.',
attachTo: {
element: '#vygr-nav',
on: 'bottom'
},
classes: 'example-step-extra-class',
buttons: [
{
text: 'Next',
action: tour.next
}
]
});
tour.start();
I'm not quite sure what I'm doing wrong - this is my first time installing a library in JavaScript.
Thanks in advance for any help