fix(webui): add type declaration for *.mjs worker imports

This commit is contained in:
yiling
2026-07-18 14:03:31 +08:00
parent b59f439683
commit 0ad3aca083
2 changed files with 10 additions and 1 deletions
@@ -6,8 +6,12 @@ import React, { useCallback, useEffect, useImperativeHandle, useRef, useState }
import { FileViewerProps, MediaController } from '../types'
import { PdfControlBar } from './pdf-control-bar'
const { default: pdfworker } = await import('@/ui/public/pdf.worker.min.mjs', {
with: { type: 'file' },
})
if (typeof window !== 'undefined' && pdfjsLib.GlobalWorkerOptions) {
pdfjsLib.GlobalWorkerOptions.workerSrc = '/pdf.worker.min.mjs'
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfworker
}
export const PdfViewer = React.forwardRef<MediaController, FileViewerProps>(
+5
View File
@@ -7,3 +7,8 @@ declare module '*?url' {
const content: string
export default content
}
declare module '*.mjs' {
const content: string
export default content
}