Fix showing pdfs in production

Removed redundant PDF.js worker initialization from
PDFViewer component and updated the worker source path in main.tsx.

Downgraded react-pdf to v8.0.2 to resolve compatibility issues and
fixed missing newline in nginx.conf.
pull/48/head
Jaronim Pracht 2025-06-02 19:06:25 +02:00
parent 9aa6c8be87
commit 1b06867d88
5 changed files with 6 additions and 12 deletions

View File

@ -19,11 +19,11 @@ services:
coordinator:
build:
context: backend/coordinator
dockerfile: ../../Dockerfile
env_file:
- .env
depends_on:
- db
db:
condition: service_healthy
healthcheck:
test: wget --spider --no-verbose http://127.0.0.1:5000/health || exit 1
interval: 10s

View File

@ -20,4 +20,4 @@ server {
location = /50x.html {
root /usr/share/nginx/html;
}
}
}

View File

@ -26,7 +26,7 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-material-file-upload": "^0.0.4",
"react-pdf": "^9.2.1",
"react-pdf": "^8.0.2",
"socket.io-client": "^4.8.1"
},
"devDependencies": {

View File

@ -1,16 +1,11 @@
import { useEffect, useRef, useState } from "react";
import { Document, Page, pdfjs } from "react-pdf";
import { Document, Page } from "react-pdf";
import "react-pdf/dist/esm/Page/AnnotationLayer.css";
import "react-pdf/dist/esm/Page/TextLayer.css";
import ArrowCircleLeftIcon from "@mui/icons-material/ArrowCircleLeft";
import ArrowCircleRightIcon from "@mui/icons-material/ArrowCircleRight";
import { Box, IconButton } from "@mui/material";
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
"pdfjs-dist/build/pdf.worker.min.mjs",
import.meta.url,
).toString();
interface PDFViewerProps {
pitchBookId: string;
}

View File

@ -34,9 +34,8 @@ declare module "@tanstack/react-router" {
}
}
// Initialize PDF.js worker
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
"pdfjs-dist/build/pdf.worker.min.mjs",
"pdfjs-dist/build/pdf.worker.min.js",
import.meta.url,
).toString();