Files
low-code-react-app-b/docs/BUILD_FIX_COMPLETE.md

2.8 KiB

Build Fix Complete

Issue

The build was failing with the error:

[vite]: Rollup failed to resolve import "@github/spark/hooks" from "/workspaces/low-code-react-app-b/src/hooks/use-project-state.ts".

Root Cause

The codebase was importing from @github/spark/hooks which doesn't exist in the build environment. This was a leftover reference from when the packages folder existed.

Solution

Replaced all imports of @github/spark/hooks with the local @/hooks/use-kv implementation throughout the codebase.

Files Modified

Component Files

  • src/App.refactored.tsx
  • src/App.simple.tsx
  • src/components/AtomicComponentDemo.tsx
  • src/components/ComprehensiveDemoPage.tsx
  • src/components/DockerBuildDebugger.tsx
  • src/components/FaviconDesigner.tsx
  • src/components/FeatureIdeaCloud.tsx
  • src/components/GlobalSearch.tsx
  • src/components/JSONDemoPage.tsx
  • src/components/JSONLambdaDesigner.tsx

Hook Files

  • src/hooks/use-project-state.ts
  • src/hooks/data/use-array.ts
  • src/hooks/data/use-components.ts
  • src/hooks/data/use-data-source.ts
  • src/hooks/data/use-data-sources.ts
  • src/hooks/data/use-files.ts
  • src/hooks/data/use-json-data.ts
  • src/hooks/data/use-lambdas.ts
  • src/hooks/data/use-models.ts
  • src/hooks/data/use-workflows.ts
  • src/hooks/feature-ideas/use-feature-ideas.ts
  • src/hooks/feature-ideas/use-idea-connections.ts
  • src/hooks/feature-ideas/use-idea-groups.ts
  • src/hooks/feature-ideas/use-node-positions.ts
  • src/hooks/ui/use-schema-editor.ts
  • src/hooks/use-navigation-history.ts

Config Files

  • src/config/orchestration/data-source-manager.ts
  • src/lib/json-ui/hooks.ts (re-exported via @/lib/json-ui)

Change Pattern

All instances of:

import { useKV } from '@github/spark/hooks'

Were replaced with:

import { useKV } from '@/hooks/use-kv'

Storage Implementation

The local useKV hook (src/hooks/use-kv.ts) uses the storage service (@/lib/storage-service) which:

  • Defaults to IndexedDB for client-side persistence
  • Can be configured to use a Flask API backend via environment variable or UI settings
  • Automatically falls back to IndexedDB if the Flask API fails

TypeScript Definitions

The window.spark global object is properly typed in src/vite-env.d.ts and includes:

  • llmPrompt: Template string function for creating prompts
  • llm: Function for calling LLM APIs
  • user: Function for getting current user info
  • kv: Key-value storage API (keys, get, set, delete)

Build Status

All TypeScript import errors resolved Build should now complete successfully Docker multi-arch builds should work

Next Steps

  1. Run npm run build to verify the build completes
  2. Test the Docker build process
  3. Verify the application works correctly in production