diff --git a/src/components/_shared/SolidSwiper/ArticleCardSwiper.tsx b/src/components/_shared/SolidSwiper/ArticleCardSwiper.tsx index 645abcb9..8020c91b 100644 --- a/src/components/_shared/SolidSwiper/ArticleCardSwiper.tsx +++ b/src/components/_shared/SolidSwiper/ArticleCardSwiper.tsx @@ -1,6 +1,6 @@ import { For, onMount, Show } from 'solid-js' import { Icon } from '../Icon' -import { register } from 'swiper/element/bundle' + import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper' import { SwiperRef } from './swiper' import { clsx } from 'clsx' @@ -15,7 +15,8 @@ type Props = { export const ArticleCardSwiper = (props: Props) => { const mainSwipeRef: { current: SwiperRef } = { current: null } - onMount(() => { + onMount(async () => { + const { register } = await import('swiper/element/bundle') register() SwiperCore.use([Pagination, Navigation, Manipulation]) }) diff --git a/src/components/_shared/SolidSwiper/ImageSwiper.tsx b/src/components/_shared/SolidSwiper/ImageSwiper.tsx index 23a9f623..d22c5196 100644 --- a/src/components/_shared/SolidSwiper/ImageSwiper.tsx +++ b/src/components/_shared/SolidSwiper/ImageSwiper.tsx @@ -3,7 +3,6 @@ import { MediaItem, UploadedFile } from '../../../pages/types' import { Icon } from '../Icon' import { Popover } from '../Popover' import { useLocalize } from '../../../context/localize' -import { register } from 'swiper/element/bundle' import { DropArea } from '../DropArea' import { createFileUploader } from '@solid-primitives/upload' import SwiperCore, { Manipulation, Navigation, Pagination } from 'swiper' @@ -135,7 +134,8 @@ export const ImageSwiper = (props: Props) => { handleSlideDescriptionChange(slideIndex(), 'body', slideBody()) } - onMount(() => { + onMount(async () => { + const { register } = await import('swiper/element/bundle') register() SwiperCore.use([Pagination, Navigation, Manipulation]) })