Files
soroban-abacus-flashcards/apps/web/tsconfig.server.json
Thomas Hallock ab94fd350f fix: use dynamic ES module imports for @svg-maps packages in know-your-world
Fixes production errors where Socket.IO server failed with "Unexpected token 'export'"
when loading map data from @svg-maps/world and @svg-maps/usa packages.

**Changes:**

- **maps.ts**: Use dynamic `import()` for ES modules instead of JSON workaround
  - Async loading via `ensureMapSourcesLoaded()` works in both browser and Node.js
  - Sync Proxy exports (`WORLD_MAP`, `USA_MAP`) for client components
  - Async functions (`getMapData()`, `getFilteredMapData()`) for server-side use
  - Remove JSON data files (world.json, usa.json) - now load directly from npm packages

- **Client components**: Use sync map exports instead of async functions
  - MapRenderer, PlayingPhase, ResultsPhase, SetupPhase, StudyPhase, MapRenderer.stories
  - Import `WORLD_MAP`/`USA_MAP` or use `getFilteredMapDataSync()`
  - No more Promise handling needed in React components

- **Page component**: Disable SSR to prevent build-time errors
  - Use Next.js `dynamic()` import with `ssr: false`
  - Prevents race condition during static generation

- **tsconfig.server.json**: Include maps.ts and related files for server compilation

**Testing:**
-  Docker build succeeds
-  Socket.IO server loads: "Socket server module loaded successfully"
-  Zero ES module errors in production build
-  Maps load correctly from @svg-maps packages via dynamic imports

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 12:16:54 -06:00

47 lines
1.2 KiB
JSON

{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"target": "es2022",
"outDir": "./dist",
"rootDir": "./src",
"noEmit": false,
"incremental": false,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"moduleResolution": "node",
"types": ["node", "react"]
},
"include": [
"src/db/index.ts",
"src/db/schema/**/*.ts",
"src/db/migrate.ts",
"src/lib/arcade/**/*.ts",
"src/arcade-games/**/Validator.ts",
"src/arcade-games/**/types.ts",
"src/arcade-games/know-your-world/maps.ts",
"src/arcade-games/know-your-world/continents.ts",
"src/arcade-games/know-your-world/mapColors.ts",
"src/app/games/matching/context/types.ts",
"src/app/games/matching/utils/cardGeneration.ts",
"src/app/games/matching/utils/matchValidation.ts",
"src/app/arcade/memory-quiz/types.ts",
"src/socket-server.ts"
],
"exclude": [
"node_modules",
"dist",
"src/components/**/*",
"src/contexts/**/*",
"src/hooks/**/*",
"src/stories/**/*",
"src/utils/**/*",
"src/arcade-games/**/components/**/*",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.spec.ts"
]
}