Skip to content

Commit ae9ebbd

Browse files
committed
fix: use typeof document check for env detection
1 parent 5adabfb commit ae9ebbd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ export default (target: Element, options: Options): CustomScrollAction[] => {
241241
//TODO: remove this hack when microbundle will support typescript >= 4.0
242242
const windowWithViewport = window as unknown as Window & {
243243
visualViewport: visualViewport
244+
if (typeof document === 'undefined') {
245+
// If there's no DOM we assume it's not in a browser environment
246+
return []
244247
}
245248

246249
const { scrollMode, block, inline, boundary, skipOverflowHiddenElements } =

0 commit comments

Comments
 (0)