Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
fix(react): ship dist as index.mjs and index.cjs so Node parses each bundle correctly
nirholasbeafb0eba757
diff --git a/packages/react/build.mjs b/packages/react/build.mjsindex 44e6a2fd0..e4bbc1106 100644--- a/packages/react/build.mjs+++ b/packages/react/build.mjs@@ -1,7 +1,9 @@#!/usr/bin/env node-// Build @three-ws/react with esbuild (same toolchain as the other SDKs) —+// Build @three-ws/react with esbuild (same toolchain as the other SDKs):// ESM + CJS bundles from src/index.js, react left external, plus the-// hand-written type declarations copied into dist/.+// hand-written type declarations copied into dist/. The bundles use the+// .mjs/.cjs extensions so Node parses each correctly without a "type"+// field or a MODULE_TYPELESS reparse warning.import { build } from 'esbuild';import { mkdirSync, copyFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';@@ -21,7 +23,7 @@ const common = {logLevel: 'info',};-await build({ ...common, format: 'esm', outfile: resolve(outDir, 'index.esm.js') });-await build({ ...common, format: 'cjs', outfile: resolve(outDir, 'index.cjs.js') });+await build({ ...common, format: 'esm', outfile: resolve(outDir, 'index.mjs') });+await build({ ...common, format: 'cjs', outfile: resolve(outDir, 'index.cjs') });copyFileSync(resolve(here, 'src/index.d.ts'), resolve(outDir, 'index.d.ts'));-console.log('[react] built dist/index.esm.js, dist/index.cjs.js, dist/index.d.ts');+console.log('[react] built dist/index.mjs, dist/index.cjs, dist/index.d.ts');diff --git a/packages/react/package-lock.json b/packages/react/package-lock.jsonindex ccf8d9895..a4dd29ee3 100644--- a/packages/react/package-lock.json+++ b/packages/react/package-lock.json@@ -1,18 +1,21 @@{"name": "@three-ws/react",- "version": "1.0.1",+ "version": "1.0.2","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "@three-ws/react",- "version": "1.0.1",- "license": "Apache-2.0",+ "version": "1.0.2",+ "license": "SEE LICENSE IN LICENSE","devDependencies": {"esbuild": "^0.27.7","react": "^18.0.0","react-dom": "^18.0.0"},+ "engines": {+ "node": ">=20"+ },"peerDependencies": {"react": ">=17.0.0","react-dom": ">=17.0.0"diff --git a/packages/react/package.json b/packages/react/package.jsonindex 6e3e088c7..2403fa40b 100644--- a/packages/react/package.json+++ b/packages/react/package.json@@ -2,14 +2,14 @@"name": "@three-ws/react","version": "1.0.2","description": "React components for embedding three.ws 3D AI agents",- "main": "dist/index.cjs.js",- "module": "dist/index.esm.js",+ "main": "dist/index.cjs",+ "module": "dist/index.mjs","types": "dist/index.d.ts","exports": {".": {"types": "./dist/index.d.ts",- "import": "./dist/index.esm.js",- "require": "./dist/index.cjs.js"+ "import": "./dist/index.mjs",+ "require": "./dist/index.cjs"}},"files": [diff --git a/packages/react/test/agent3d.test.mjs b/packages/react/test/agent3d.test.mjsindex e20ef8b7c..ed26e4df2 100644--- a/packages/react/test/agent3d.test.mjs+++ b/packages/react/test/agent3d.test.mjs@@ -4,7 +4,7 @@import { test } from 'node:test';import assert from 'node:assert/strict';-import { Agent3D } from '../dist/index.esm.js';+import { Agent3D } from '../dist/index.mjs';import { render, iframeSrc, attrOf, styleOf } from './helpers.mjs';// --- Embed URL construction -------------------------------------------------diff --git a/packages/react/test/exports.test.mjs b/packages/react/test/exports.test.mjsindex 07853e7f4..798a3c2ce 100644--- a/packages/react/test/exports.test.mjs+++ b/packages/react/test/exports.test.mjs@@ -7,11 +7,11 @@ import { createRequire } from 'node:module';import { readFileSync } from 'node:fs';import { fileURLToPath } from 'node:url';-import * as esm from '../dist/index.esm.js';+import * as esm from '../dist/index.mjs';import { render, iframeSrc } from './helpers.mjs';const require = createRequire(import.meta.url);-const cjs = require('../dist/index.cjs.js');+const cjs = require('../dist/index.cjs');const FORWARD_REF = Symbol.for('react.forward_ref');