sole / Animated_GIF

Javascript library for creating animated GIFs
https://sole.github.io/Animated_GIF
225 stars 53 forks source link

es6 import error (SyntaxError: expected expression, got '<') #37

Open Sjeiti opened 4 years ago

Sjeiti commented 4 years ago

When doing a regular es6 import I got the error SyntaxError: expected expression, got '<' Animated_GIF.worker:1.

This is due to the fact that the script is trying to load a missing webworker from the root and the index.html is served.

The default es6 is import Animated_GIF from 'animated_gif' but package.json main points to the src file which does not have the webworker combined. One solution is to point to the correct file with import Animated_GIF from 'animated_gif/dist/Animated_GIF.min'. The other is to update the package.json main.

I could do a pull request but do I update package.json or update README.md with the correct es6 import? The former would require an npm publish as well.

ps: npm install node_modules should only contain the dist js, it might be wise to add files to package.json as well.