fix: skip optional deps to avoid sharp compilation on Cloudflare Pages

Added omit=optional to .npmrc to prevent @xenova/transformers from
trying to compile sharp with native dependencies. Sharp is only used
for server-side image processing which isn't needed in the browser.

Also added override for sharp version in package.json as fallback.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2025-11-29 23:03:36 -08:00
parent 3f0fb1f85d
commit ee13540646
2 changed files with 6 additions and 1 deletions

4
.npmrc
View File

@ -1,3 +1,5 @@
legacy-peer-deps=true
strict-peer-dependencies=false
auto-install-peers=true
auto-install-peers=true
# Skip optional dependencies to avoid native compilation issues (e.g., sharp in @xenova/transformers)
omit=optional

View File

@ -92,5 +92,8 @@
},
"engines": {
"node": ">=20.0.0"
},
"overrides": {
"sharp": "0.33.5"
}
}