Swiper Slider does not provide an export named ‘Navigation’

I am working on a project with Quasar Framework. I wanted to integrate swiper slider. I have installed it with the npm command and I can see it’s installed version as [email protected]. However, when I insert the styling in the quasar.config.ts, I am getting 404 error for the css bundle. This is the part in the quasar.config.ts file:

css: ['app.scss', 'swiper/swiper-bundle.css'],

On the other side, if I remove it, and try to use it without the bundle, I am having an error as the following:

Uncaught SyntaxError: The requested module '/node_modules/.q-cache/vite/spa/deps/swiper.js?t=1725545338593&v=dd38fd58' does not provide an export named 'Navigation' (at SwiperSlider.vue:24:22)

Here is my SwiperSlider.vue

<template>
  <div>
    <swiper
      class="mySwiper"
      :slides-per-view="1"
      :navigation="true"
      :pagination="true"
    >
      <swiper-slide>Slide 1</swiper-slide>
      <swiper-slide>Slide 2</swiper-slide>
      <swiper-slide>Slide 3</swiper-slide>
    </swiper>
  </div>
</template>

<script setup lang="ts">
import { Swiper, SwiperSlide } from 'swiper/vue';
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';
</script>

<style scoped>
.mySwiper {
  width: 100%;
  height: 300px;
}
</style>


Without the navigation and pagination, I cannot use the buttons to swipe through other slides. Please let me know if these information are not enough. Thanks in advance! (Please keep in mind that, in Quasar Framework projects, there are no main.ts or main.js file unlikely Vue projects)

List of thing I have tried already:

  1. I insert the css bundle on the quasar.config.ts file as I mention above. (Dind’t work)
  2. I tried to run it without the bundle, I used import for the bundles in the component. (Dind’t work)
  3. I asked GPT-4, but not giving a proper solution.
  4. I changed the sytax from <script setup> to <script setup lang="ts">
  5. I also checked the other questions/answers from StackOverFlow, but not found what I need as well.

[vue-tsc] Cannot find module ‘swiper/vue’ or its corresponding type declarations.
/Users/tolgahandayanikli/Desktop/Quasar Dashboard/src/components/Miscellaneous/SwiperSlider/SwiperSlider.vue:17:37
15 |
16 |

17 | import { Swiper, SwiperSlide } from ‘swiper/vue’;
| ^^^^^^^^^^^^
18 | import ‘swiper/css’;
19 | import ‘swiper/css/navigation’;
20 | import ‘swiper/css/pagination’;

You’re using swiper/vue component, however, it’s recommended by the documentation to use Swiper Element (Web Component) instead, which is very simple to use.

Create swiper.js file in Quasar’s boot directory

src/boot/swiper.js

// import function to register Swiper custom elements
import { register } from 'swiper/element/bundle';
// register Swiper custom elements
register();

Then in quasar.config.js add swiper as a boot file.

quasar.config.js

export default configure((/* ctx */) => {
  return {
    // https://v2.quasar.dev/quasar-cli/boot-files
    boot: ["swiper"],
    ...
  }
})

That is all that is necessary to get swiper working in Vue + Quasar project. You don’t need to import anything within your .vue component file.

Dealing with console warnings

As a side note, warnings will appear in the browser dev console that the swiper elements fail to resolve even though they function correctly. There is a solution to this posted on the swiper github for Vue projects. To implement the solution with Quasar, look for “viteVuePluginOptions” within quasar.config.js and make the following change:

quasar.config.js

viteVuePluginOptions: {
  template: {
    compilerOptions: {
      isCustomElement: (tag) => tag.includes("swiper"),
    },
  },
},

The warnings will now be suppressed.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật