Instead of creating a stub onnxruntime-node module, patch the
@xenova/transformers backend file to skip the onnxruntime-node
import entirely and use only onnxruntime-web.
This prevents the "Cannot read properties of undefined" error
when the library tries to use the Node backend in a Node.js
environment but only has the web backend available.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The @xenova/transformers package unconditionally imports both
onnxruntime-node and onnxruntime-web at module load time. This
causes immediate failure on Alpine Linux (musl libc) because
onnxruntime-node requires glibc.
Solution: Created alpine:setup script that replaces onnxruntime-node
with a stub module after npm install. The transformers library will
automatically fall back to onnxruntime-web (WASM backend).
Usage on Alpine:
npm install
npm run alpine:setup
npm run build
npm run index:all
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>