diff --git a/docs/PR_FIX2_CANVAS_CONFETTI_BODY.md b/docs/PR_FIX2_CANVAS_CONFETTI_BODY.md new file mode 100644 index 00000000..560eac2a --- /dev/null +++ b/docs/PR_FIX2_CANVAS_CONFETTI_BODY.md @@ -0,0 +1,39 @@ +# PR: Optional canvas-confetti via CDN (Fix 2) + +Copy from "Summary" below for the PR description. + +--- + +## Summary + +Makes the celebration service work when the `canvas-confetti` package is not installed in `node_modules`, so the app builds and runs without "Failed to resolve import 'canvas-confetti'" (e.g. after a fresh clone before `npm install`, or in environments where dependencies are not fully installed). + +**When the import fails:** The error occurs when Vite tries to resolve `canvas-confetti` at build or dev startup and the package is missing from `node_modules` — for example right after cloning the repo without running `npm install`, or in a workspace where dependencies have not been installed yet. We did not observe it in CI, Tauri build, or a specific Node version; it was the "package not installed" case. + +**Implementation:** +- Load confetti at runtime from a CDN script instead of bundling the npm package. No `import 'canvas-confetti'` in source, so Vite never tries to resolve it. +- Use a **module-scoped cached promise** for the load so that only one `