3D: Fix CI/CD deploy (worker vite build issue) (#1858)

This commit is contained in:
Tanish Manku authored and GitHub committed 2026-08-07 08:47:10 -07:00
1 parent a1435df07d
commit ea0de174c9
4 files changed
+22 -5

No files matched your search

@@ -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,
@@ -29,7 +29,9 @@ export const ToolbarDivider = () => (
<span className="h-7 w-px shrink-0 bg-ui-divider" aria-hidden />
);
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;
@@ -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 }
+10
View File
@@ -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;
}