From f4d7448c9d3e0ce5896b91dc7c8ae8f97dab1af5 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Thu, 12 Mar 2026 10:23:04 -0700 Subject: [PATCH] fix(rnetwork): use UMD build for 3d-force-graph, avoid ESM bare specifiers ESM builds on esm.sh kept resolving transitive deps to latest versions that import three/webgpu. Switch to the pre-built UMD bundle from jsdelivr which bundles all deps including Three.js. Keep separate import map entry for "three" ESM for custom node object creation. Co-Authored-By: Claude Opus 4.6 --- modules/rnetwork/components/folk-graph-viewer.ts | 4 ++-- modules/rnetwork/mod.ts | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/rnetwork/components/folk-graph-viewer.ts b/modules/rnetwork/components/folk-graph-viewer.ts index a05ca6e..fc1b4fe 100644 --- a/modules/rnetwork/components/folk-graph-viewer.ts +++ b/modules/rnetwork/components/folk-graph-viewer.ts @@ -542,8 +542,8 @@ class FolkGraphViewer extends HTMLElement { this.graphContainer = container; try { - const ForceGraph3DModule = await import("3d-force-graph"); - const ForceGraph3D = ForceGraph3DModule.default || ForceGraph3DModule; + const ForceGraph3D = (window as any).ForceGraph3D; + if (!ForceGraph3D) throw new Error("ForceGraph3D not loaded — check UMD script tag"); const graph = ForceGraph3D({ controlType: "orbit" })(container) .backgroundColor("rgba(0,0,0,0)") diff --git a/modules/rnetwork/mod.ts b/modules/rnetwork/mod.ts index 1b341bd..fa6f226 100644 --- a/modules/rnetwork/mod.ts +++ b/modules/rnetwork/mod.ts @@ -12,14 +12,14 @@ import { getModuleInfoList } from "../../shared/module"; import type { RSpaceModule } from "../../shared/module"; import { renderLanding } from "./landing"; -// ── CDN importmap for Three.js + 3d-force-graph ── -const GRAPH3D_IMPORTMAP = ` +`; @@ -439,7 +439,7 @@ routes.get("/", (c) => { moduleId: "rnetwork", spaceSlug: space, modules: getModuleInfoList(), - head: GRAPH3D_IMPORTMAP, + head: GRAPH3D_HEAD, body: ` `, scripts: ``,