swiper 9.* does not support SSR #6389
Unanswered
CPengXiang
asked this question in
Q&A
Replies: 2 comments
-
I have the same problem with Nextjs and Sveltekit projects. |
Beta Was this translation helpful? Give feedback.
0 replies
-
smoothScroll not support ssr |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Check that this is really a bug
Reproduction link
https://www.mi.com/fr/store
Bug description
I am upgrading from Swiper 6.8.4 to Swiper 9.0.3, our website need SSR, Swiper 6 colud use SSR, But I found Swiper 8 or Swiper 9 does not support SSR, now what shoul i do, i want upgrading to Swiper 9, But it doesn't support my needs now
Expected Behavior
No response
Actual Behavior
when i use our SSR service publish some page, i get this message, i hope it can work but not
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /
/node_modules/swiper/react/swiper-react.js/node_modules//node_modules/swiper/react/swiper-react.js from /~/node_modules//lib/src/blocks/Swiper/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.require() of ES modules is not supported.
require() of /
Instead rename swiper-react.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /~/node_modules/*/node_modules/swiper/package.json.
code: 'ERR_REQUIRE_ESM'
}
Swiper version
9.0.3
Platform/Target and Browser Versions
macOS、Windows、Cordova、iOS、Android、Chrome
Validations
Would you like to open a PR for this bug?
Beta Was this translation helpful? Give feedback.
All reactions