refactor: centralize CDN config and fix service worker fallback

- Centralize CDN versions/URLs in cdn-version.ts
- Switch LibreOffice to @bentopdf/libreoffice-wasm package
- Fix service worker fallback to support all WASM packages
- Remove dead code and silence production logs
This commit is contained in:
abdullahalam123
2025-12-30 22:58:25 +05:30
parent 659a4b1a32
commit 2f8086ad59
30 changed files with 560 additions and 338 deletions

View File

@@ -308,6 +308,23 @@ docker build --build-arg COMPRESSION_MODE=all -t bentopdf:all .
| `o` | originals | Development or custom compression |
| `all` | all formats | Maximum compatibility (default) |
**CDN Optimization:**
BentoPDF can use jsDelivr CDN to serve large WASM files (LibreOffice, Ghostscript, PyMuPDF) for improved performance and reduced bandwidth costs:
```bash
# Production build with CDN (Recommended)
VITE_USE_CDN=true npm run build
# Standard build with local files only
npm run build
```
**How it works:**
- When `VITE_USE_CDN=true`: Browser loads WASM files from jsDelivr CDN (fast, global delivery)
- Local files are **always included** as automatic fallback
- If CDN fails then it falls back to local files
**Subdirectory Hosting:**
BentoPDF can also be hosted from a subdirectory (e.g., `example.com/tools/bentopdf/`):