Auto-detect WASM fallback for unsupported platforms (Termux/Android)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 32.7k
- Forks
- 1.4k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Description
## Problem
Sharp v0.35.2 fails to load on Termux (Android ARM64):
```
Error: Could not load the "sharp" module using the android-arm64 runtime
```
No prebuilt binaries exist for `android-arm64v8`.
## Workaround (verified working)
```bash
npm install @img/sharp-wasm32
```
## Proposed Solution
Auto-detect unsupported platforms and fall back to WASM:
```javascript
if (loadError && !process.env.SHARP_IGNORE_WASM_FALLBACK) {
try {
module.exports = require('@img/sharp-wasm32');
return;
} catch (_wasmError) {}
}
```
## Benefits
- Zero-config for unsupported platforms
- WASM is slower but functional
- Opt-out via `SHARP_IGNORE_WASM_FALLBACK=1`
## Related
- #3850, #4324, #4161
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the sharp module-loading path that emits the android-arm64 runtime error, and inspect how unsupported platforms are currently handled. Verify the proposed fallback with the @img/sharp-wasm32 package on Termux/Android, including the SHARP_IGNORE_WASM_FALLBACK opt-out; done means unsupported platforms load successfully without breaking supported ones.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, wasm
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100