gif-frames icon indicating copy to clipboard operation
gif-frames copied to clipboard

Problem with using Vite + Vue

Open 6474131 opened this issue 1 year ago • 5 comments

image

I get this error and I'm not really sure how to fix it, although it seems similar to https://github.com/benwiley4000/gif-frames/issues/37. For reference all I'm doing is importing gif-frames, I'm not doing anything else at the moment.

6474131 avatar Mar 31 '23 03:03 6474131

me too

liangtian123 avatar Dec 15 '23 09:12 liangtian123

My guess is this is due to the dependencies (get pixels, save pixels) relying on node.js packages built into browserify, webpack etc and perhaps they're not supported by vite. Really wild guess, I'm not sure.

benwiley4000 avatar Dec 15 '23 14:12 benwiley4000

The following information is key to resolving this issue: I copied gif-frames.js into my project and then processed it

var EE = require_events().EventEmitter;
if (!EE.listenerCount)
EE.listenerCount = function(emitter, type) {
return emitter.listeners(type).length;
};

save-pixels-jpeg-js-upgrade.js?v=88a5b38b:39 Module "events" has been externalized for browser compatibility. Cannot access "events.EventEmitter" in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

image

liangtian123 avatar Dec 18 '23 08:12 liangtian123

I downloaded https://unpkg.com/[email protected]/dist/gif-frames.min.js locally, put it into my project, and then introduced it in index.html, and the problem was solved

Note that package.json does not need to introduce "gif-frames": "^1.0.1" again

liangtian123 avatar Dec 18 '23 09:12 liangtian123

I guess Vite doesn't handle UMDs

Ben

Le lun. 18 déc. 2023, 4 h 17 a.m., Oliver @.***> a écrit :

I downloaded @.***/dist/gif-frames.min.js locally, put it into my project, and then introduced it in index.html, and the problem was solved

Note that package.json does not need to introduce "gif-frames": "^1.0.1" again

— Reply to this email directly, view it on GitHub https://github.com/benwiley4000/gif-frames/issues/48#issuecomment-1859867906, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHOD3NS6JBUQF2PVADNPTTYKAC2LAVCNFSM6AAAAAAWODV3JCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZHA3DOOJQGY . You are receiving this because you commented.Message ID: @.***>

benwiley4000 avatar Dec 18 '23 12:12 benwiley4000