0

I wanted to check out vue and use it for my next project. I wanted to use Hooper, a image carousel. I've installed it via npm install hooper. Now in my script file I use

  import { Hooper, Slide } from 'hooper';
  import 'hooper/dist/hooper.css';

  export default {
    name: 'App',
    components: {
      Hooper,
      Slide
    }
  }

But that already throws an error in the first line:

Uncaught SyntaxError: Unexpected token {

I've already installed it in one folder above the script file, besides it, and in a folder, but the js file does not recognize the bracket. How do I solve this?

8
  • 1
    Do you use webpack? Or just trying to run this code via browser? stackoverflow.com/questions/41722621/… Commented Sep 19, 2019 at 6:16
  • "Now in my script file..." which script file is that? Commented Sep 19, 2019 at 6:17
  • No, I don't use webpack, because I use Kirby as CMS, and there is no documentation in using a copiler with a CMS. Of course I want to use it in my browser, where else lol Commented Sep 19, 2019 at 6:21
  • Correct me if I get any of this wrong but I'm guessing this is in a .js file and you are running node path/to/script.js and seeing the error in your terminal / cli. If so, check out How can I use an es6 import in node? Commented Sep 19, 2019 at 6:26
  • I've also tried to use this script inside my html file, between script tags, but still got this error. Commented Sep 19, 2019 at 6:30

1 Answer 1

0

Ok; I did not know that I have to wrap the script inside <script type="module"></script> Apparently it works now. Thanks?

Sign up to request clarification or add additional context in comments.

Comments