Cannot find module 'swiper/bundle' or its corresponding type declarations.
I'm following the following tutorial: https://swiperjs.com/get-started
I have a simple TypeScript application with the following files:
- index.ts
- tsconfig.json
- package.json
- I created a new package.json using:
npm init -y - I installed TypeScript:
npm i -D typescript - I create a new tsconfig.json using:
npx tsc --init - I installed swiper using:
npm i swiper - I added
import Swiper from 'swiper';andimport 'swiper/css';to my index.ts as per the 1st example from https://swiperjs.com/get-started => no complains. - I deleted everything in index.ts.
- I added
import Swiper, { Navigation, Pagination } from 'swiper';,import 'swiper/css';,import 'swiper/css/navigation';, andimport 'swiper/css/pagination';to my index.ts as per the 2nd example from https://swiperjs.com/get-started => no complains. - I deleted everything in index.ts.
- I added
import Swiper from 'swiper/bundle';andimport 'swiper/css/bundle';to my index.ts as per the 3rd example from https://swiperjs.com/get-started => 💥BOOM!💥Cannot find module 'swiper/bundle' or its corresponding type declarations.
Demo: https://github.com/spacecat/swiper-cannot-find-module
Questions:
- Why am I getting the
Cannot find module 'swiper/bundle' or its corresponding type declarations.error? - How do I fix it?
Thanks!
Hello @spacecat. Please provide a online reproduction by codesandbox or a minimal GitHub repository. You can fork one of our demos in codesandbox to get start. Issues labeled by missing demo will be closed if no activities in 3 days.
@nolimits4web I've added the reproduction demo.
I've added the following for now:
// @ts-ignore
import Swiper from 'swiper/bundle';
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.