Skip to content

Vue3 - Failed to resolve component: swiper-slide and swiper-container #7333

Closed Answered by erkage
erkage asked this question in Q&A
Discussion options

You must be logged in to vote

After checking Swiper's code and thinking it over I realised what's going on and with that I found the solution in Vue's docs.

TLDR
As Swiper using web-components when Vue try to resolve <swiper-container> tag as a Vue component it's not exists, so you have to tell Vue to not resolve those tags.

My (Vite) config which solved the problem:

...
plugins: [
  Vue({
    template: {
      compilerOptions: {
        isCustomElement: (tag) => tag.includes('swiper')
      }
    }
  }),
],
...

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by erkage
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants