naver / egjs-view360

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

vue3-view360 - 4.0.0-beta.7 (next) is not working in production build but working in development mode. #423

Closed fpuncea closed 1 year ago

fpuncea commented 1 year ago

Description

When using vue 3 with composition api it's not working on production build while in development mode works fine. Using "@egjs/vue3-view360": "^4.0.0-beta.7".

Steps to check or reproduce

<View360 class="is-16by9 view360" :projection="projection" ref="viewer" @dblclick="handleDoubleClick"> ...

 import { View360, EquirectProjection, EVENTS, ProjectionChangeEvent, LoadStartEvent } from '@egjs/vue3-view360'
 import '@egjs/vue3-view360/css/view360.min.css'`

export default defineComponent({
  name: 'image-view-360',`
  components: {
    View360
  },
  setup (props) {
    const viewer = ref(null) as any
    const handleDoubleClick = (evt) => {
      console.log('viewer', viewer)
    }
    return {
        viewer
    }
  }
}

The properties of viewer.value are all undefined when building for production like shown bellow: https://ibb.co/D7xfzt3 But when building in development all the properties are there https://ibb.co/T2bRGV5 We are not using any special build conditions, just the default yarn build which is mapped to vue-cli-service build --mode=development or production. What are we doing wrong ?

Any help would be appreciated. Thanks

Tom-revere commented 1 year ago

I am also having this issue, but with Vite. I thought I was doing something wrong but glad to see I wasn't.

fpuncea commented 1 year ago

Workaround: You can still access those properties and methods but under different path like this: viewer.value._.data.view360. This shouldn't be the right way, though.

Tom-revere commented 1 year ago

Thanks @fpuncea!

For me it was viewer._.data.view360 but it now works as it would normally.

But as you say, this shouldn't be needed.

daybrush commented 1 year ago

@fpuncea @Tom-revere

Both dev and production are buggy. It is normal that only projection has a value. I will be fixed soon.

And can you try to access it with viewer.value.view360?

malangfox commented 1 year ago

Since there is no further comment, we will close the issue.