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

Method of using without bundler

Open lionirdeadman opened this issue 5 years ago • 5 comments

Is there a way to use this without a bundler (like browserify)?

lionirdeadman avatar Jun 14 '19 04:06 lionirdeadman

It was possible some time ago, but then I split codebase a bit for easier maintainability. You may check out earlier commits.

I will consider providing pre-compiled bundles though.

Kagami avatar Jun 14 '19 08:06 Kagami

I've tried V1 but it seems it doesn't work with my AVIFs that I made with your go-avif tool while it does in the demo, I've not been able to see which commit changed it from not needing a bundler to needing one, if you could point to that it'd be nice.

Although, Pre-compiled bundles would be better. I would really appreciate it.

lionirdeadman avatar Jun 14 '19 21:06 lionirdeadman

@Kagami Would you mind show me how to pre-compiled bundles? I'm new in nodejs.

hoangvietfreelancer avatar Mar 05 '20 07:03 hoangvietfreelancer

Have you successfully used this library without a bundler or using browserify from the cli?

Actually, I'm at this step:

browserify reg.js -o bundle.js

/Volumes/MHDCS/git_repositories/github/xyz/node_modules/avif.js/avif.js:78
export function register(regPromise, opts) {
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

sycured avatar Aug 26 '22 06:08 sycured

Have you successfully used this library without a bundler or using browserify from the cli?

Actually, I'm at this step:

browserify reg.js -o bundle.js

/Volumes/MHDCS/git_repositories/github/xyz/node_modules/avif.js/avif.js:78
export function register(regPromise, opts) {
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

@sycured You need to use esmify to add ES Modules support to browserify:

npm install esmify browser-resolve
browserify reg.js  -p esmify -o avif-bundle.js

Note that you also need to run browserify for avif-sw.js

kenvix avatar Jun 15 '23 11:06 kenvix