3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
Load the crucible-scene module in Node without a DOM (#2178)
Nguyen Xuan An63244106b897
diff --git a/src/crucible-scene.js b/src/crucible-scene.jsindex a03344cf..80ffc61c 100644--- a/src/crucible-scene.js+++ b/src/crucible-scene.js@@ -51,7 +51,11 @@ async function createLiveRenderer(canvas, scene) {return { renderer, environment };}-export class CrucibleSceneElement extends HTMLElement {+// The package is imported in Node too (server rendering, the package smoke), where there is no DOM;+// the element only registers in a browser.+const ElementBase = typeof HTMLElement === 'undefined' ? class {} : HTMLElement;++export class CrucibleSceneElement extends ElementBase {static observedAttributes = ['src', 'poster'];#renderer = null;diff --git a/tests/scene-pack.test.js b/tests/scene-pack.test.jsindex de7f8ee4..6ef61ac6 100644--- a/tests/scene-pack.test.js+++ b/tests/scene-pack.test.js@@ -135,3 +135,9 @@ test('the <crucible-scene> runtime imports no agent-scene compiler code', asyncconst compilerModules = inputs.filter(path => /src\/(agent-scene(?!-capabilities)|agent-look|agent-apply|scene-pack\.js)/.test(path));assert.deepEqual(compilerModules, []);});++test('the crucible-scene module imports in Node without a DOM, as the package smoke does', async () => {+ assert.equal(typeof globalThis.HTMLElement, 'undefined');+ const module = await import('../src/crucible-scene.js');+ assert.equal(typeof module.CrucibleSceneElement, 'function');+});