Even though Swiper React is working, ESLint is unable to resolve the path

Viewed 297

I am working on a project using Nextjs (version 11.1.0), Chakra UI/React (version 1.6.6) and Swiper React (version 7.0.2). It's working properly, but I am getting this ESLint issue:

Unable to resolve path to module 'swiper/react'`.

I already tried to use type: modules in package.json and the experimental flag in next config experimental: { esmExternals: true }. Using type: modules solves it but then Nextjs throws an error asking to remove it. The experimental flag does nothing.

Currently, these are my imports:

import { Swiper, SwiperSlide } from 'swiper/react'
import 'swiper/css'
import 'swiper/css/free-mode'

I already tried variations such as:

import { Swiper, SwiperSlide } from 'swiper/react/swiper-react.js'"

but that doesn't work either.

0 Answers
Related