fix(web-admin): polyfill Buffer/global for contract Word export in Vite

html-to-docx still reads Node globals after Vite rebundles; inject buffer polyfill, map global to globalThis, and alias the package to the browser build.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-09-05 15:06:20 +08:00
1 parent 8bbc716d17
commit f872333df6
5 files changed
+58 -5

No files matched your search

+12
View File
@@ -17,6 +17,18 @@ declare module 'vue-img-cutter'
declare module 'file-saver'
declare module 'buffer'
declare module '@turbodocx/html-to-docx' {
const HTMLtoDOCX: (
htmlString: string,
headerHTMLString?: string | null,
documentOptions?: Record<string, unknown>,
footerHTMLString?: string | null
) => Promise<Blob | ArrayBuffer>
export default HTMLtoDOCX
}
declare module '@turbodocx/html-to-docx/dist/html-to-docx.browser.esm.js' {
const HTMLtoDOCX: (
htmlString: string,