diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 5a278aeba4..69cc2bf03e 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -16,7 +16,6 @@ import { RichText, } from '@atproto/api' import {TID} from '@atproto/common-web' -import * as dcbor from '@ipld/dag-cbor' import {t} from '@lingui/core/macro' import {type QueryClient} from '@tanstack/react-query' import {sha256} from 'js-sha256' @@ -505,6 +504,12 @@ const mf_sha256 = Hasher.from({ }) async function computeCid(record: AppBskyFeedPost.Record): Promise { + /* + * Lazily loaded since it's only needed when posting a thread, and its + * `cborg` dependency is ~190KB that would otherwise be in the initial + * web bundle. + */ + const dcbor = await import('@ipld/dag-cbor') // IMPORTANT: `prepareObject` prepares the record to be hashed by removing // fields with undefined value, and converting BlobRef instances to the // right IPLD representation.