Search code examples
angulartypescriptionic-frameworkswiper.jsionic2-calendar

ionic2-calendar Error: Module not Found: Angular is not exported from package Swiper


I updated the package of my project

  • Ionic + angular to generate app for IOS and Android
  • Ionic: 7
  • Angular: 16

Since this recommendation

ion-slides was deprecated in v6.0.0 and removed in v7.0.0. We recommend using the Swiper.js library directly.

I migrated to the last version of swiper(version= 9.3.2)

But after update package.json and run ionic build I got this issue

./node_modules/ionic2-calendar/fesm2020/ionic2-calendar.mjs:8:0-37 - Error: Module not 
found: Error: Package path ./angular is not exported from package 
/Users/admin/Projects/<name_project>/node_modules/swiper (see exports field in 
/Users/admin/Projects/<name_project>/node_modules/swiper/package.json)

I reviewed node_modules/swiper and I did't find a path to angular And checking the code of ionic2-calendar I see that they try import swiper/angular

import * as i3 from 'swiper/angular';
import { SwiperModule } from 'swiper/angular'

Checking this answer it looks like Swiper Version 9 doesn't have support to Angular and we need to migrate to the new way to use swiper in angular. I did that in my code but in the third part code like ionic2-calendar I didn't do that

What is the recommendation in this case? Should I downgraded the version 9 and use the version 8?


Solution

  • I downgraded Swiper from version 9 to Version 8.4.7 that works for me

    The last version of ionic2-calendar was updated 4 month ago almost the same Date of the update of Swiper to version 9, so probably to use the last version of Swiper we nee to wait for a new update ionic2-calendar enter image description here