Home > Net >  SyntaxError: Unexpected identifier <Component Name>. import call expects one or two arguments
SyntaxError: Unexpected identifier <Component Name>. import call expects one or two arguments

Time:09-15

I am using Vue 2.

I am trying to use a component (VueSlickCarousel) from npm.

I have installed the component using npm.

In my website I have added:

<div id="app"></div>

I am also using the VUE CDN:

<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>

I have a script like this:

<script>
  import VueSlickCarousel from 'vue-slick-carousel';
  var app = new Vue({
    components: { VueSlickCarousel },
    ...
  })
</script>

I am getting this error:

SyntaxError: Unexpected identifier 'VueSlickCarousel'. import call expects one or two arguments.

How can I import this component? Thanks for your help!!

CodePudding user response:

Removing the import statement and replacing it with the CDN adding the following fixed the issue.

components: { 
  VueSlickCarousel : window['vue-slick-carousel']
}
  • Related