Donaldcwl / browser-image-compression

Image compression in web browser
MIT License
1.3k stars 160 forks source link

File not defined #26

Closed srdjag closed 5 years ago

srdjag commented 5 years ago

While working in Nuxt, if I import imageCompression from "browser-image-compression"; into a compontent (page), a single page reload/refresh will throw File not defined error and freeze that window. image This is how it looks, every now and then it shows the actual error if it does not freeze by then.

srdjag commented 5 years ago

image

srdjag commented 5 years ago

FIXED

I managed to fix this by adding the following code: head: { script: [{ src: "/browser-image-compression.js" }] }

in Vue compontent.

Then, download https://cdn.jsdelivr.net/npm/browser-image-compression@1.0.5/dist/browser-image-compression.js script and put it in static folder.