Skip to content

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.

fix(deps): patch @pump-fun SDK ESM type after install

nirholas357326bbb846
diff --git a/package.json b/package.json
index a5ea29dcc..8a6315669 100644
--- a/package.json
+++ b/package.json
@@ -40,7 +40,7 @@
]
},
"scripts": {
- "postinstall": "npm run build --prefix agent-payments-sdk",
+ "postinstall": "npm run build --prefix agent-payments-sdk && node scripts/fix-pump-sdk-esm.mjs",
"dev": "vite --port 3000",
"dev:lib": "TARGET=lib vite",
"build": "vite build",
diff --git a/scripts/fix-pump-sdk-esm.mjs b/scripts/fix-pump-sdk-esm.mjs
new file mode 100644
index 000000000..5463d1009
--- /dev/null
+++ b/scripts/fix-pump-sdk-esm.mjs
@@ -0,0 +1,44 @@
+// Patches @pump-fun/pump-sdk and @pump-fun/pump-swap-sdk after install.
+//
+// Both packages ship `dist/esm/index.js` containing ES `import` statements,
+// but neither the package root nor the `dist/esm/` directory declares
+// `"type": "module"`. Node.js loads those files as CommonJS and throws
+// "Cannot use import statement outside a module" at first dynamic import.
+//
+// We drop a `{"type":"module"}` package.json into each `dist/esm/` folder so
+// Node treats the bundle as ESM. Idempotent; survives `npm ci` via postinstall.
+
+import { mkdirSync, writeFileSync, existsSync, readFileSync } from 'node:fs';
+import { dirname, join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const root = dirname(fileURLToPath(import.meta.url));
+const repo = dirname(root);
+
+const targets = [
+ 'node_modules/@pump-fun/pump-sdk/dist/esm',
+ 'node_modules/@pump-fun/pump-swap-sdk/dist/esm',
+];
+
+let patched = 0;
+let skipped = 0;
+for (const rel of targets) {
+ const dir = join(repo, rel);
+ if (!existsSync(dir)) {
+ skipped++;
+ continue;
+ }
+ const pkgPath = join(dir, 'package.json');
+ const desired = { type: 'module' };
+ if (existsSync(pkgPath)) {
+ const current = JSON.parse(readFileSync(pkgPath, 'utf8'));
+ if (current.type === 'module') {
+ skipped++;
+ continue;
+ }
+ }
+ writeFileSync(pkgPath, JSON.stringify(desired, null, 2) + '\n');
+ patched++;
+}
+
+console.log(`[fix-pump-sdk-esm] patched ${patched}, skipped ${skipped}`);