Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiper 9.0.0 with NexJS with Virtual slides enabled does not work. #6318

Closed
5 of 6 tasks
kukicado opened this issue Feb 1, 2023 · 0 comments
Closed
5 of 6 tasks

Swiper 9.0.0 with NexJS with Virtual slides enabled does not work. #6318

kukicado opened this issue Feb 1, 2023 · 0 comments
Labels

Comments

@kukicado
Copy link

kukicado commented Feb 1, 2023

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/p/sandbox/vigilant-meninsky-iedpus?file=%2Fpages%2Findex.tsx&selection=%5B%7B%22endColumn%22%3A59%2C%22endLineNumber%22%3A19%2C%22startColumn%22%3A59%2C%22startLineNumber%22%3A19%7D%5D

Bug description

When using Swiper 9 with Virtual slides enabled on a NextJS website you get an error saying that the document is not defined. Swiper 9 does work with NextJs when Virtual slides are not enabled.

Virtual slides with NextJs worked on version 8.4.6 without issue.

Expected Behavior

Swiper 9 should work in Virtual mode when using Next.js

Actual Behavior

Full error:

Server Error
ReferenceError: document is not defined

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
Virtual
file:///project/sandbox/node_modules/swiper/modules/virtual/virtual.js (29:19)
<unknown>
file:///project/sandbox/node_modules/swiper/core/core.js (78:7)
Array.forEach
<anonymous>
new Swiper
file:///project/sandbox/node_modules/swiper/core/core.js (77:20)
initSwiper
file:///project/sandbox/node_modules/swiper/react/swiper.js (62:25)
<unknown>
file:///project/sandbox/node_modules/swiper/react/swiper.js (76:5)
renderWithHooks
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5658:16)
renderForwardRef
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5842:18)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6005:11)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderNode
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6259:12)
renderHostElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5642:3)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5952:5)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderNode
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6259:12)
renderChildrenArray
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6211:7)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6141:7)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5971:9)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderIndeterminateComponent
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5785:7)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5946:7)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderIndeterminateComponent
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5785:7)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5946:7)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderNode
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6259:12)
renderChildrenArray
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6211:7)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6141:7)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5971:9)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderNode
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6259:12)
renderChildrenArray
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6211:7)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6141:7)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5971:9)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderContextProvider
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5920:3)
renderElement
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6017:11)
renderNodeDestructiveImpl
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6104:11)
renderNodeDestructive
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (6076:14)
renderContextProvider
file:///project/sandbox/node_modules/react-dom/cjs/react-dom-server.browser.development.js (5920:3)

Swiper version

9.0.0

Platform/Target and Browser Versions

Windows

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a Swiper issue and not a framework-specific issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant