Files
actual/packages/api/package.json
Claude 332db28e2e [AI] Add browser-compatible build for @actual-app/api
The API package was previously Node.js-only due to its dependency on
better-sqlite3 and Node.js fs/path modules. This adds a browser build
that uses loot-core's existing browser platform implementations
(sql.js/WASM, IndexedDB, absurd-sql) instead.

Changes:
- Add index.web.ts: browser entry point (no Node.js version check or
  node-fetch polyfill)
- Add vite.browser.config.ts: browser-targeted Vite build that resolves
  to browser platform files (index.ts) instead of Node.js ones
  (index.api.ts -> index.electron.ts)
- Update package.json: conditional exports (browser vs default/node),
  module field, build:browser script
- Update tsconfig.json: exclude new config file from type checking

The browser build outputs dist/browser.js (ESM) alongside the existing
dist/index.js (CJS/Node). Bundlers that support the "browser" condition
in package.json exports will automatically use the browser build.

https://claude.ai/code/session_01MnxRXLNjqXrVb5CdsC85Fb
2026-03-20 21:27:31 +00:00

1.6 KiB