naver / egjs-view360

360 integrated viewing solution
https://naver.github.io/egjs-view360/
MIT License
483 stars 89 forks source link

Error in Nuxt3 - View360.EquirectProjection is not a constructor #431

Open mamun-devxhub opened 10 months ago

mamun-devxhub commented 10 months ago

Description

In Nuxt3, I'm getting this View360.EquirectProjection is not a constructor Error for the version "@egjs/vue3-view360": "^4.0.0-beta.7",

How to solve this, and I also want to know the proper away to Integrate view360 for Nuxt3 Projects.

Steps to check or reproduce

In Nuxt3 I use this code..

<script setup>
import { View360, EquirectProjection } from "@egjs/vue3-view360";
import "@egjs/vue3-view360/css/view360.min.css";

const projection = new EquirectProjection({
  src: "/image.jpg"
});
</script>

<template>
  <View360 class="is-16by9" :projection="projection" />
</template>

And I'm getting this error..

index.vue:11 Uncaught (in promise) TypeError: View360.EquirectProjection is not a constructor
    at setup (index.vue:11:22)
    at callWithErrorHandling (chunk-S2INE2O3.js:1750:18)
    at setupStatefulComponent (chunk-S2INE2O3.js:7767:25)
    at setupComponent (chunk-S2INE2O3.js:7728:36)
    at mountComponent (chunk-S2INE2O3.js:6365:7)
    at hydrateNode (chunk-S2INE2O3.js:5397:11)
    at hydrateSubTree (chunk-S2INE2O3.js:6441:13)
    at ReactiveEffect.componentUpdateFn [as fn] (chunk-S2INE2O3.js:6461:13)
    at ReactiveEffect.run (chunk-S2INE2O3.js:1408:23)
    at instance.update (chunk-S2INE2O3.js:6580:52)

How to fix this.

naashw commented 9 months ago

If you have this error : "__vite_ssr_import_2__.EquirectProjection is not a constructor"

you need to disable "SSR" in nuxt.config.ts export default defineNuxtConfig({ ssr:false });