mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 04:27:56 +00:00
0ea3b9df1f
## Problem Frontend was showing 'connecting network' message on production (pezkuwichain.io) because: 1. WebSocket endpoint was hardcoded to localhost in App.tsx 2. DEFAULT_ENDPOINT in polkadot.ts was not reading environment variables ## Solution ### shared/blockchain/polkadot.ts - Added getWebSocketEndpoint() function to read VITE_NETWORK and corresponding VITE_WS_ENDPOINT_* env vars - Changed DEFAULT_ENDPOINT from hardcoded value to call getWebSocketEndpoint() - Now correctly uses wss://ws.pezkuwichain.io in production ### web/src/App.tsx - Removed hardcoded endpoint="ws://127.0.0.1:9944" prop from PolkadotProvider - Now uses DEFAULT_ENDPOINT which reads from environment ### web/vite.config.ts - Minor formatting improvements (no functional changes) ### CLAUDE_README_KRITIK.md (New file) - Critical documentation for future Claude instances - Documents VPS validator setup, bootnode configuration - Strict warnings not to modify working blockchain - Troubleshooting commands and procedures - Frontend deployment steps ## Result - Production site now correctly connects to wss://ws.pezkuwichain.io - Environment-based configuration working as expected - Local dev still uses ws://127.0.0.1:9944 ## Files Changed - shared/blockchain/polkadot.ts: Dynamic endpoint selection - web/src/App.tsx: Remove hardcoded endpoint - CLAUDE_README_KRITIK.md: Critical documentation (new)
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react-swc";
|
|
import path from "path";
|
|
|
|
// https://vitejs.dev/config/
|
|
export default defineConfig(({ mode }) => ({
|
|
server: {
|
|
host: "::",
|
|
port: 8081,
|
|
hmr: {
|
|
protocol: 'ws',
|
|
host: 'localhost',
|
|
port: 8081,
|
|
},
|
|
watch: {
|
|
usePolling: true,
|
|
},
|
|
},
|
|
plugins: [
|
|
react()
|
|
].filter(Boolean),
|
|
define: {
|
|
'global': 'globalThis',
|
|
'process.env': {}
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": path.resolve(__dirname, "./src"),
|
|
"@pezkuwi/i18n": path.resolve(__dirname, "../shared/i18n"),
|
|
"@pezkuwi/lib": path.resolve(__dirname, "../shared/lib"),
|
|
"@pezkuwi/utils": path.resolve(__dirname, "../shared/utils"),
|
|
"@pezkuwi/theme": path.resolve(__dirname, "../shared/theme"),
|
|
"@pezkuwi/types": path.resolve(__dirname, "../shared/types"),
|
|
},
|
|
dedupe: ['@polkadot/util-crypto', '@polkadot/util', '@polkadot/api', '@polkadot/extension-dapp', '@polkadot/keyring'],
|
|
},
|
|
optimizeDeps: {
|
|
include: ['@polkadot/util-crypto', '@polkadot/util', '@polkadot/api', '@polkadot/extension-dapp', '@polkadot/keyring'],
|
|
esbuildOptions: {
|
|
define: {
|
|
global: 'globalThis'
|
|
}
|
|
}
|
|
},
|
|
assetsInclude: ['**/*.json'],
|
|
})); |