diff --git a/api/migrate.ts b/api/migrate.ts index 6daaea4..dc6d655 100644 --- a/api/migrate.ts +++ b/api/migrate.ts @@ -1,6 +1,8 @@ import { NextRequest, NextResponse } from 'next/server'; import { Pool } from 'pg'; -import cardsData from '../src/data/cards.json'; + +// Use require for JSON import to avoid module issues +const cardsData = require('../src/data/cards.json'); // Create PostgreSQL connection pool const pool = new Pool({ diff --git a/api/tsconfig.json b/api/tsconfig.json new file mode 100644 index 0000000..18603cf --- /dev/null +++ b/api/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "CommonJS", + "moduleResolution": "node", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "resolveJsonModule": true, + "declaration": false, + "outDir": "./dist" + }, + "include": [ + "**/*.ts" + ], + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/vercel.json b/vercel.json index a024fa7..be81e47 100644 --- a/vercel.json +++ b/vercel.json @@ -52,7 +52,8 @@ ], "functions": { "api/**/*.ts": { - "runtime": "@vercel/node@3.0.7" + "runtime": "@vercel/node@3.2.0" } - } + }, + "buildCommand": "npm run build" }