From c1a22cf33a60c3383dc77cb91079466047aea5c5 Mon Sep 17 00:00:00 2001 From: Matthieu Sieben Date: Tue, 23 Apr 2024 21:32:18 +0200 Subject: [PATCH] fix(ozone): properly import "lande" ES module (from CJS) --- packages/ozone/src/mod-service/lang.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/ozone/src/mod-service/lang.ts b/packages/ozone/src/mod-service/lang.ts index 08cb6f69d87..6c17f11ad1e 100644 --- a/packages/ozone/src/mod-service/lang.ts +++ b/packages/ozone/src/mod-service/lang.ts @@ -1,10 +1,3 @@ -import lande from 'lande' - -import { ModerationService } from '.' -import { ModSubject } from './subject' -import { ModerationSubjectStatusRow } from './types' -import { langLogger as log } from '../logger' -import { code3ToCode2 } from './lang-data' import { AppBskyActorProfile, AppBskyFeedGenerator, @@ -12,6 +5,12 @@ import { AppBskyGraphList, } from '@atproto/api' +import { ModerationService } from '.' +import { ModSubject } from './subject' +import { ModerationSubjectStatusRow } from './types' +import { langLogger as log } from '../logger' +import { code3ToCode2 } from './lang-data' + export class ModerationLangService { constructor(private moderationService: ModerationService) {} @@ -102,6 +101,8 @@ export class ModerationLangService { .map((lang) => lang.split('-')[0]) .forEach((lang) => langs.add(lang)) } else if (recordText) { + // 'lande' is an esm module, so we need to import it dynamically + const { default: lande } = await import('lande') const detectedLanguages = lande(recordText) if (detectedLanguages.length) { const langCode = code3ToCode2(detectedLanguages[0][0])