Merge pull request 'PDFjs Import Fix' (#133) from pdfjs-worker-fix into staging
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m10s
All checks were successful
Release to Staging / build_and_release (push) Successful in 1m10s
Reviewed-on: #133
This commit is contained in:
commit
88d988e60b
@ -36,8 +36,10 @@ import {
|
||||
import { truncate } from 'lodash'
|
||||
import { hexToNpub } from '../../utils'
|
||||
import { toPdfFiles } from '../../utils/pdf.ts'
|
||||
PDFJS.GlobalWorkerOptions.workerSrc =
|
||||
'node_modules/pdfjs-dist/build/pdf.worker.mjs'
|
||||
PDFJS.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.mjs',
|
||||
import.meta.url
|
||||
).toString()
|
||||
|
||||
interface Props {
|
||||
selectedFiles: File[]
|
||||
|
@ -3,8 +3,10 @@ import * as PDFJS from 'pdfjs-dist'
|
||||
import { PDFDocument } from 'pdf-lib'
|
||||
import { Mark } from '../types/mark.ts'
|
||||
|
||||
PDFJS.GlobalWorkerOptions.workerSrc =
|
||||
'node_modules/pdfjs-dist/build/pdf.worker.mjs'
|
||||
PDFJS.GlobalWorkerOptions.workerSrc = new URL(
|
||||
'pdfjs-dist/build/pdf.worker.mjs',
|
||||
import.meta.url
|
||||
).toString()
|
||||
|
||||
/**
|
||||
* Scale between the PDF page's natural size and rendered size
|
||||
|
@ -5,6 +5,15 @@ import tsconfigPaths from 'vite-tsconfig-paths'
|
||||
export default defineConfig({
|
||||
plugins: [react(), tsconfigPaths()],
|
||||
build: {
|
||||
target: 'ES2022'
|
||||
target: 'ES2022',
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
if (id.includes('pdfjs-dist/build/pdf.worker.mjs')) {
|
||||
return 'pdf.worker'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user