completionId: cgen-dadbbd3279e54b0b8f91e720d7315edb
cgen-dadbbd3279e54b0b8f91e720d7315edb
This commit is contained in:
parent
f26047f125
commit
09f2752949
1 changed files with 23 additions and 1 deletions
24
build-api.js
24
build-api.js
|
|
@ -90,4 +90,26 @@ function fixImportsInDir(dir) {
|
|||
fixImportsInDir(destApi);
|
||||
console.log(`✓ Fixed ESM imports in ${fixedCount} files`);
|
||||
|
||||
console.log("\n✓ API build complete! Vercel will serve the JavaScript files.");
|
||||
// Step 4: Remove TypeScript files so Vercel doesn't recompile them
|
||||
console.log("Step 4: Removing TypeScript source files...");
|
||||
let removedCount = 0;
|
||||
|
||||
function removeTypeScriptFiles(dir) {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
removeTypeScriptFiles(fullPath);
|
||||
} else if (entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
||||
fs.unlinkSync(fullPath);
|
||||
removedCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeTypeScriptFiles(destApi);
|
||||
console.log(`✓ Removed ${removedCount} TypeScript files`);
|
||||
|
||||
console.log("\n✓ API build complete! Vercel will serve the pre-compiled JavaScript files.");
|
||||
|
|
|
|||
Loading…
Reference in a new issue