Skip to content

Commit

Permalink
chore(rax-swiper): enhance comments
Browse files Browse the repository at this point in the history
  • Loading branch information
linbudu599 committed Jul 20, 2023
1 parent 1ebaa32 commit 1632112
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
14 changes: 11 additions & 3 deletions packages/rax-swiper/src/web/init-swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ import { needsNavigation, needsPagination, needsScrollbar } from './utils';
// both support webpack 4 and 5 resolving rule.
import 'swiper/swiper-bundle.min.css';

// TODO: Support SSR in Swiper component of HyperKit
// A temporary solution to prevent swiper.js errors under SSR
document.documentElement.style = document.documentElement.style || {};
/**
* TODO: Support SSR in Swiper component of HyperKit.
* Temporary solution to prevent swiper.js errors under SSR.
*
* Swiper.js use ssr-window under the hood, which ensure `document` is defined.
* So we need to ensure `document.documentElement` and `document.documentElement.style` only.
*/
if (!document.documentElement?.style) {
document.documentElement = document.documentElement || {};
document.documentElement.style = document.documentElement.style || {};
}

Swiper.use([Autoplay, Pagination]);
function initSwiper(swiperParams) {
Expand Down
11 changes: 8 additions & 3 deletions packages/rax-view/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
"noImplicitThis": false,
"outDir": "lib",
"baseUrl": ".",
"allowSyntheticDefaultImports": true
"allowSyntheticDefaultImports": true,
},
"include": ["src/**/*"],
"exclude": ["node_modules", "lib"]
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"lib"
]
}

0 comments on commit 1632112

Please sign in to comment.