Skip to content

Commit 5582ab3

Browse files
committed
fix next config
1 parent 0e4e239 commit 5582ab3

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

apps/playground/app/chat/page.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
"use client"
22

3-
export const dynamic = 'force-dynamic'
4-
53
import { useState, useEffect } from "react"
64
import { Textarea } from "@/components/ui/textarea"
75
import { Badge } from "@/components/ui/badge"
8-
import { ScrollArea } from "@/components/ui/scroll-area"
96
import { Bot } from "lucide-react"
107
import Sidebar from "@/components/sidebar"
118
import { useAgentStore, useAgentRestore, useIsInitialized } from "@/stores/agent-store"
12-
import { ASSETS_PROMPT, XCM_PROMPT } from "@polkadot-agent-kit/llm"
139
import { SystemMessage, HumanMessage, ToolMessage } from "@langchain/core/messages"
1410

1511
interface ChatMessage {
@@ -102,6 +98,9 @@ export default function ChatPage() {
10298
const tools = getLangChainTools(agentKit)
10399
const modelWithTools = chatModel.bindTools(tools)
104100

101+
// Dynamically import prompts to avoid build-time issues
102+
const { ASSETS_PROMPT, XCM_PROMPT } = await import("@polkadot-agent-kit/llm")
103+
105104
const messages = [
106105
new SystemMessage({ content: ASSETS_PROMPT + XCM_PROMPT }),
107106
new HumanMessage({ content: userMessage.content }),

apps/playground/app/config/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client"
22

3-
export const dynamic = 'force-dynamic'
43

54
import { useState, useEffect, useRef } from "react"
65
import { useRouter } from "next/navigation"
@@ -9,12 +8,12 @@ import { Card } from "@/components/ui/card"
98
import { Input } from "@/components/ui/input"
109
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
1110
import { Badge } from "@/components/ui/badge"
12-
import { Settings, Key, Cpu, Loader2, Check, ArrowLeft, ArrowRight, Link } from "lucide-react"
11+
import { Key, Cpu, Loader2, Check, ArrowLeft, ArrowRight, Link } from "lucide-react"
1312
import Sidebar from "@/components/sidebar"
1413
import { ChainSelector } from "@/components/chain-selector"
1514
import { useAgentStore, useIsInitialized } from "@/stores/agent-store"
1615
import { useToast } from "@/hooks/use-toast"
17-
import type { KnownChainId, KeyType } from "@polkadot-agent-kit/common"
16+
import type { KeyType } from "@polkadot-agent-kit/common"
1817
interface AgentConfig {
1918
llmProvider: string
2019
llmModel: string

apps/playground/app/developer/page.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
"use client"
22

3-
export const dynamic = 'force-dynamic'
4-
53
import { useEffect, useMemo, useState } from "react"
64
import Sidebar from "@/components/sidebar"
75
import { Badge } from "@/components/ui/badge"
86
import { Card } from "@/components/ui/card"
97
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
108
import { Input } from "@/components/ui/input"
11-
import { Textarea } from "@/components/ui/textarea"
129
import { Button } from "@/components/ui/button"
13-
import { ScrollArea } from "@/components/ui/scroll-area"
1410
import { Play, Zap, Terminal, X, Loader2 } from "lucide-react"
1511
import {
1612
Collapsible,

apps/playground/next.config.mjs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const nextConfig = {
99
images: {
1010
unoptimized: true,
1111
},
12-
webpack: (config) => {
12+
webpack: (config, { isServer }) => {
1313
// Enable WebAssembly used by downstream SDK deps
1414
config.experiments = {
1515
...(config.experiments || {}),
@@ -24,6 +24,23 @@ const nextConfig = {
2424
asyncFunction: true,
2525
},
2626
}
27+
28+
// Configure WASM file handling
29+
config.module.rules.push({
30+
test: /\.wasm$/,
31+
type: 'asset/resource',
32+
})
33+
34+
// Externalize Polkadot packages on server to avoid build-time execution
35+
if (isServer) {
36+
config.externals = config.externals || []
37+
config.externals.push({
38+
'@polkadot/wasm-crypto': '@polkadot/wasm-crypto',
39+
'@polkadot/wasm-bridge': '@polkadot/wasm-bridge',
40+
'@polkadot/wasm-util': '@polkadot/wasm-util',
41+
})
42+
}
43+
2744
return config
2845
},
2946
}

0 commit comments

Comments
 (0)