Import sharp when used

This commit is contained in:
Samuel Elliott 2024-10-15 23:57:17 +01:00
parent c966b7309e
commit 445093e58a
No known key found for this signature in database
GPG Key ID: 8420C7CDE43DC4D6

View File

@ -1,7 +1,6 @@
import * as fs from 'node:fs/promises';
import * as path from 'node:path';
import { Request } from 'express';
import sharp from 'sharp';
import { CoopRule, FestVoteState, FriendOnlineState, StageScheduleResult } from 'splatnet3-types/splatnet3';
import { dir } from '../util/product.js';
import createDebug from '../util/debug.js';
@ -101,6 +100,8 @@ export async function renderUserEmbedImage(
const start = Date.now();
debug('generating image, format %s', PresenceEmbedFormat[format]);
const { default: sharp } = await import('sharp');
let image = sharp(Buffer.from(svg)).withMetadata({
density: 72 * 2,
});