Swiper import error in ssr mode #13160
Unanswered
sadeq-qafari
asked this question in
CLI - SSR mode
Replies: 1 comment 3 replies
-
|
Swiper is not built with SSR in mind and it must run only on client-side, so do just that. |
Beta Was this translation helpful? Give feedback.
3 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.
-
im trying to use swiper in my quasar v2 codebase
it works fine in spa mode but i get this error in ssr mode:
Must use import to load ES Module: D:\MY_CODE_BASE\node_modules\swiper\vue\swiper-vue.js require() of ES modules is not supported. require() of D:\MY_CODE_BASE\node_modules\swiper\vue\swiper-vue.js from D:\MY_CODE_BASE 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. Instead rename swiper-vue.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from D:\MY_CODE_BASE\node_modules\swiper\package.json.Beta Was this translation helpful? Give feedback.
All reactions