feat: add experimental configuration and update PDF viewer error message
This commit is contained in:
parent
8c802dcabf
commit
0d423aa2f4
3 changed files with 15 additions and 4 deletions
3
apps/infoalloggi/compose_prod.sh
Normal file
3
apps/infoalloggi/compose_prod.sh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
BUILDKIT_PROGRESS=plain docker compose -f dev-docker-compose.yml up -d --force-recreate --build
|
||||
|
|
@ -10,6 +10,9 @@ const nextConfig = {
|
|||
compiler: {
|
||||
removeConsole: false,
|
||||
},
|
||||
experimental: {
|
||||
// esmExternals: "loose", // This if react-pdf gives compilation issues
|
||||
},
|
||||
|
||||
devIndicators: false,
|
||||
headers: async () => {
|
||||
|
|
|
|||
|
|
@ -6,10 +6,12 @@ import "react-pdf/dist/Page/TextLayer.css";
|
|||
import type { PDFDocumentProxy } from "pdfjs-dist";
|
||||
import { LoadingPage } from "./loading";
|
||||
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
||||
"pdfjs-dist/build/pdf.worker.min.mjs",
|
||||
import.meta.url,
|
||||
).toString();
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
|
||||
|
||||
// pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
||||
// "pdfjs-dist/build/pdf.worker.min.mjs",
|
||||
// import.meta.url,
|
||||
// ).toString();
|
||||
|
||||
const options = {
|
||||
cMapUrl: "/cmaps/",
|
||||
|
|
@ -55,6 +57,9 @@ export const PDFViewer = ({ url }: { url: string }) => {
|
|||
className={"overflow-auto aspect-[1/1.4142]"}
|
||||
file={file}
|
||||
loading={<LoadingPage />}
|
||||
noData={
|
||||
"Errore nel caricare il documento, riprova più tardi o Scaricalo"
|
||||
}
|
||||
onLoadSuccess={onDocumentLoadSuccess}
|
||||
options={options}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue