Files
OSIT-AE-App-Svelte/package.json
Scott Idem 9c30d4618a fix(build): postinstall script patches flowbite-svelte TypeScript optional params
flowbite-svelte ships TypeScript optional-param syntax (x?: string, event?: MouseEvent,
date?: Date) in its dist .svelte files. Vite's esbuild dep pre-bundler processes these
files (via dist/*/index.js re-exports) and fails with "Unexpected '?'" parse errors
whenever the lockfile changes and the dep cache is rebuilt.

- Add scripts/postinstall.mjs: patches 4 specific TypeScript signatures in
  CommandPalette.svelte, ScrollSpy.svelte, and Datepicker.svelte after every npm install.
  Patches are idempotent and targeted — only the ?-in-param-position syntax is removed;
  optional-chaining (?.) in function bodies is untouched.
- Add "postinstall" script to package.json to run it automatically.
- Upgrade flowbite-svelte 1.31.0 → 1.33.1 (both have the same issue; 1.33.1 is current).
- npm update now works without breaking the dev server.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-22 18:33:53 -04:00

4.7 KiB