mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
perf: Lazy import Mammoth dep (#12538)
This commit is contained in:
@@ -2,7 +2,6 @@ import { parse } from "@fast-csv/parse";
|
||||
import { JSDOM } from "jsdom";
|
||||
import { escapeRegExp } from "es-toolkit/compat";
|
||||
import { simpleParser } from "mailparser";
|
||||
import mammoth from "mammoth";
|
||||
import type { Node } from "prosemirror-model";
|
||||
import { DOMParser as ProsemirrorDOMParser } from "prosemirror-model";
|
||||
import yaml from "js-yaml";
|
||||
@@ -259,6 +258,8 @@ export class DocumentConverter {
|
||||
*/
|
||||
private static async docxToHtml(content: Buffer | string): Promise<string> {
|
||||
if (content instanceof Buffer) {
|
||||
// Loaded lazily to keep mammoth off the startup path — only docx imports need it.
|
||||
const mammoth = (await import("mammoth")).default;
|
||||
const { value } = await traceFunction({ spanName: "convertToHtml" })(
|
||||
mammoth.convertToHtml
|
||||
)({
|
||||
|
||||
Reference in New Issue
Block a user