diff --git a/frontend/libs/components/moodboard/src/lib/persistence/moodboardSync.ts b/frontend/libs/components/moodboard/src/lib/persistence/moodboardSync.ts index 984682a91c..2b022020ce 100644 --- a/frontend/libs/components/moodboard/src/lib/persistence/moodboardSync.ts +++ b/frontend/libs/components/moodboard/src/lib/persistence/moodboardSync.ts @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { create } from "zustand"; import { useBoardLibraryStore } from "../boards/BoardLibraryStore"; +import type { Board } from "../boards/boardTypes"; import { useMoodboardStore } from "../canvas/MoodboardStore"; import type { MoodboardAdapter, diff --git a/frontend/libs/components/moodboard/src/lib/ui/Toolbar.tsx b/frontend/libs/components/moodboard/src/lib/ui/Toolbar.tsx index 637a24b30c..277e7b3ade 100644 --- a/frontend/libs/components/moodboard/src/lib/ui/Toolbar.tsx +++ b/frontend/libs/components/moodboard/src/lib/ui/Toolbar.tsx @@ -29,7 +29,9 @@ export const ToolbarDivider = () => ( ); -interface ToolbarIconButtonProps { +// Exported: FloatingToolbarButton re-exports ToolbarIconButton, and +// declaration emit (TS4023) needs this props type to be nameable there. +export interface ToolbarIconButtonProps { icon: IconDefinition; label: string; active?: boolean; diff --git a/frontend/libs/components/upload-modal/src/lib/UploadModal3D/utilities/convertFbxToGlb.ts b/frontend/libs/components/upload-modal/src/lib/UploadModal3D/utilities/convertFbxToGlb.ts index 4dc1f431d4..4203a94ee5 100644 --- a/frontend/libs/components/upload-modal/src/lib/UploadModal3D/utilities/convertFbxToGlb.ts +++ b/frontend/libs/components/upload-modal/src/lib/UploadModal3D/utilities/convertFbxToGlb.ts @@ -1,5 +1,12 @@ import { FBXLoader } from "three/addons/loaders/FBXLoader.js"; import { GLTFExporter } from "three/addons/exporters/GLTFExporter.js"; +// `?worker&inline` (see src/vite-env.d.ts): the worker is bundled as +// self-contained inline code inside this library's output. The +// `new Worker(new URL(...), import.meta.url)` form breaks CONSUMING builds — +// the lib build rewrites it to a hashed asset path in dist/index.js, which +// the consumer's vite (worker-import-meta-url plugin) then fails to resolve +// as an entry module. +import ConvertFbxToGlbWorker from "./convertFbxToGlb.worker?worker&inline"; // Convert an FBX file (e.g. a Mixamo download) to a binary GLB, preserving // skeletal animation clips. Everything downstream of the picker — the @@ -62,10 +69,7 @@ function getWorker(): Worker | null { return worker; } try { - worker = new Worker( - new URL("./convertFbxToGlb.worker.ts", import.meta.url), - { type: "module" }, - ); + worker = new ConvertFbxToGlbWorker(); worker.onmessage = (event) => { const data = event.data as | { id: number; ok: true; glb: ArrayBuffer } diff --git a/frontend/libs/components/upload-modal/src/vite-env.d.ts b/frontend/libs/components/upload-modal/src/vite-env.d.ts new file mode 100644 index 0000000000..eac87d0d2e --- /dev/null +++ b/frontend/libs/components/upload-modal/src/vite-env.d.ts @@ -0,0 +1,10 @@ +// Vite worker-import shim (used by convertFbxToGlb.ts). `?worker&inline` +// bundles the worker as SELF-CONTAINED inline code — the only worker form +// that survives being built into this library's dist and then re-bundled by +// a consuming app's vite build. The `new Worker(new URL(...))` pattern does +// not: the lib build rewrites it to a hashed asset path that the consumer's +// worker-import-meta-url plugin then fails to resolve as an entry module. +declare module "*?worker&inline" { + const WorkerFactory: new () => Worker; + export default WorkerFactory; +}