mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 20:57:45 +00:00
fix(webui): add type declaration for *.mjs worker imports
This commit is contained in:
@@ -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>(
|
||||
|
||||
Vendored
+5
@@ -7,3 +7,8 @@ declare module '*?url' {
|
||||
const content: string
|
||||
export default content
|
||||
}
|
||||
|
||||
declare module '*.mjs' {
|
||||
const content: string
|
||||
export default content
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user