matmen / ImageScript

zero-dependency JavaScript image manipulation
https://www.npmjs.com/package/imagescript
Other
633 stars 32 forks source link

I can't seem to use this package when bundling my code for AWS lambda. #40

Open ivands opened 3 months ago

ivands commented 3 months ago

Right now, I'm bundling my code to make it ready for AWS Lambda. But because of how the WASM is loaded, the bundler can't know about the WASM files. Would it be possible to import the WASM file with a regular import statement?

Example:

import { decode } from "file.wasm"

This would allow bundlers to recognize what is happening and include the wasm file in the bundle output. Of course, node / deno will need native support for wasm imports. 🤞

matmen commented 3 months ago

The browser branch might work for you, though it uses fetch() calls to import the WASM instead of using a local binary. I'm not sure the npm version would work on AWS Lambda - even if bundled accordingly.