Compare commits

..

3 Commits

Author SHA1 Message Date
88d988e60b 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
Reviewed-on: #133
2024-08-08 09:44:19 +00:00
50b406d83a Merge branch 'staging' into pdfjs-worker-fix
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 32s
2024-08-08 12:42:58 +03:00
d5e0769692 fix: pdfjs import
Some checks failed
Open PR on Staging / audit_and_check (pull_request) Failing after 32s
2024-08-08 12:39:29 +03:00
3 changed files with 18 additions and 5 deletions

View File

@ -36,8 +36,10 @@ import {
import { truncate } from 'lodash' import { truncate } from 'lodash'
import { hexToNpub } from '../../utils' import { hexToNpub } from '../../utils'
import { toPdfFiles } from '../../utils/pdf.ts' import { toPdfFiles } from '../../utils/pdf.ts'
PDFJS.GlobalWorkerOptions.workerSrc = PDFJS.GlobalWorkerOptions.workerSrc = new URL(
'node_modules/pdfjs-dist/build/pdf.worker.mjs' 'pdfjs-dist/build/pdf.worker.mjs',
import.meta.url
).toString()
interface Props { interface Props {
selectedFiles: File[] selectedFiles: File[]

View File

@ -3,8 +3,10 @@ import * as PDFJS from 'pdfjs-dist'
import { PDFDocument } from 'pdf-lib' import { PDFDocument } from 'pdf-lib'
import { Mark } from '../types/mark.ts' import { Mark } from '../types/mark.ts'
PDFJS.GlobalWorkerOptions.workerSrc = PDFJS.GlobalWorkerOptions.workerSrc = new URL(
'node_modules/pdfjs-dist/build/pdf.worker.mjs' 'pdfjs-dist/build/pdf.worker.mjs',
import.meta.url
).toString()
/** /**
* Scale between the PDF page's natural size and rendered size * Scale between the PDF page's natural size and rendered size

View File

@ -5,6 +5,15 @@ import tsconfigPaths from 'vite-tsconfig-paths'
export default defineConfig({ export default defineConfig({
plugins: [react(), tsconfigPaths()], plugins: [react(), tsconfigPaths()],
build: { build: {
target: 'ES2022' target: 'ES2022',
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('pdfjs-dist/build/pdf.worker.mjs')) {
return 'pdf.worker'
}
}
}
}
} }
}) })