jarvisniu / vue-zoomer

Zoom the image or other thing with mouse or touch
MIT License
150 stars 37 forks source link

window is not defined when upgrade to 0.3.10 version while working on 0.3.9 #35

Closed alihamza1214 closed 2 years ago

alihamza1214 commented 2 years ago

window is not defined

at node_modules/vue-zoomer/dist/vue-zoomer.min.js:1:275 at node_modules/vue-zoomer/dist/vue-zoomer.min.js:1:146 at Object. (node_modules/vue-zoomer/dist/vue-zoomer.min.js:1:224) at Module._compile (internal/modules/cjs/loader.js:1158:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) at Module.load (internal/modules/cjs/loader.js:1002:32) at Function.Module._load (internal/modules/cjs/loader.js:901:14) at Module.require (internal/modules/cjs/loader.js:1044:19) at require (internal/modules/cjs/helpers.js:77:18) at node_modules/vue-server-renderer/build.prod.js:1:77944

jarvisniu commented 2 years ago

I don't think there has a difference about this between these two versions.

I think it is caused by SSR which this library doesn't support.

If you use Nuxt, you can easily exclude this component following this: https://nuxtjs.org/docs/features/nuxt-components#the-client-only-component

Another way it might work is import the source code like:

import VueZoomer from 'vue-zoomer/src'

But I don't know if these two methods can solve your problem.