gif-frames
gif-frames copied to clipboard
Problem with using Vite + Vue
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.
me too
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.
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.
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
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: @.***>