gif.js icon indicating copy to clipboard operation
gif.js copied to clipboard

Bundling gif.js almost works...

Open ebrensi opened this issue 4 years ago • 0 comments

I am not familiar with other bundlers, but using Parcel I can import the gif.js CoffeScript directly from the a clone of this repo, or from the npm install.

import * as GIF from "node_modules/gif.js.optimized/src/gif.coffee"

but then there is a problem with the file path for the worker. Parcel is able to successfully bundle the worker script if the worker is instantiated with a string-literal url, but unfortunately we have https://github.com/jnordberg/gif.js/blob/92d27a02841339e202c75150dcf6fe5f4fa42ec5/src/gif.coffee#L107 which abstracts the worker filename by having it in options.

This could be fixed by changing the above line to

worker = new Worker "./gif.worker.coffee"

and taking the worker file name out of options.

For people not using a bundler, this would mean they no longer have the option of renaming the worker and putting it in a different folder.

Is this a merge you would be willing to do?

ebrensi avatar Apr 01 '20 07:04 ebrensi