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: {
|
compiler: {
|
||||||
removeConsole: false,
|
removeConsole: false,
|
||||||
},
|
},
|
||||||
|
experimental: {
|
||||||
|
// esmExternals: "loose", // This if react-pdf gives compilation issues
|
||||||
|
},
|
||||||
|
|
||||||
devIndicators: false,
|
devIndicators: false,
|
||||||
headers: async () => {
|
headers: async () => {
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,12 @@ import "react-pdf/dist/Page/TextLayer.css";
|
||||||
import type { PDFDocumentProxy } from "pdfjs-dist";
|
import type { PDFDocumentProxy } from "pdfjs-dist";
|
||||||
import { LoadingPage } from "./loading";
|
import { LoadingPage } from "./loading";
|
||||||
|
|
||||||
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
|
||||||
"pdfjs-dist/build/pdf.worker.min.mjs",
|
|
||||||
import.meta.url,
|
// pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
||||||
).toString();
|
// "pdfjs-dist/build/pdf.worker.min.mjs",
|
||||||
|
// import.meta.url,
|
||||||
|
// ).toString();
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
cMapUrl: "/cmaps/",
|
cMapUrl: "/cmaps/",
|
||||||
|
|
@ -55,6 +57,9 @@ export const PDFViewer = ({ url }: { url: string }) => {
|
||||||
className={"overflow-auto aspect-[1/1.4142]"}
|
className={"overflow-auto aspect-[1/1.4142]"}
|
||||||
file={file}
|
file={file}
|
||||||
loading={<LoadingPage />}
|
loading={<LoadingPage />}
|
||||||
|
noData={
|
||||||
|
"Errore nel caricare il documento, riprova più tardi o Scaricalo"
|
||||||
|
}
|
||||||
onLoadSuccess={onDocumentLoadSuccess}
|
onLoadSuccess={onDocumentLoadSuccess}
|
||||||
options={options}
|
options={options}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue