Skip to content

Commit dd447a4

Browse files
committed
fix backend prod error
1 parent 5d8b017 commit dd447a4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apps/api/src/script/script.service.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ import { Queue } from 'bullmq';
1010
import { SupabaseService } from '../supabase/supabase.service';
1111
import { type CreateScriptInput, hasEnoughCredits, getMinimumCreditsForGemini } from '@repo/validation';
1212
import { PDFDocument, rgb, StandardFonts, PDFFont, PDFPage } from 'pdf-lib';
13-
import { marked } from 'marked';
14-
import type { Tokens } from 'marked';
1513
import * as fs from 'fs';
1614
import * as path from 'path';
1715

18-
type Token = Tokens.Generic;
16+
interface Token {
17+
type: string;
18+
tokens?: Token[];
19+
text?: string;
20+
}
1921
type Part = { text: string } | { fileData: { fileUri: string; mimeType: string } };
2022
type FontSet = { regular: PDFFont; bold: PDFFont; italic: PDFFont };
2123

@@ -293,6 +295,7 @@ export class ScriptService {
293295
currentY -= 20;
294296

295297
// --- Body content ---
298+
const { marked } = await import('marked');
296299
const tokens = marked.lexer(script.content || '');
297300
for (const token of tokens) {
298301
if (currentY < margins.bottom) {

0 commit comments

Comments
 (0)