0

My project is locally building/working fine; however on production it is failing with the following errors that I have not been able to fix:

Module not found: Can't resolve 'swiper' in '/vercel/path0/components/home/swiper' Module not found: Can't resolve 'swiper/react' in '/vercel/path0/components/home/swiper' Module not found: Can't resolve 'swiper/css' in '/vercel/path0/components/home/swiper'

I am following the latest documentation for "swiper": "^8.4.4",

import { Pagination, A11y } from "swiper";

import { Swiper, SwiperSlide } from "swiper/react";

// Import Swiper styles
import "swiper/css";
import "swiper/css/pagination";
import "swiper/css/a11y";

I wish to eslint this error away if possible (dont know how) I have tried all of the lower versions of swiper 6.8.4., 6.0.2 solutions on stackoverflow as well as the solution import { Swiper, SwiperSlide } from "swiper/react/swiper-react";. Thank you

Stackaccount1
  • 139
  • 1
  • 12

1 Answers1

0

Have you try this?

in file next.config.js: module.exports = { experimental: { esmExternals: "loose", } };