Migrate to Vite+ unified toolchain (#428)

This commit is contained in:
Gregory Schier
2026-03-13 09:27:56 -07:00
committed by GitHub
parent aed7bd12ea
commit 45262edfbd
166 changed files with 1762 additions and 1519 deletions

View File

@@ -6,13 +6,14 @@ import type { PDFDocumentProxy } from 'pdfjs-dist';
import { useEffect, useRef, useState } from 'react';
import { Document, Page } from 'react-pdf';
import { useContainerSize } from '../../hooks/useContainerQuery';
import { fireAndForget } from '../../lib/fireAndForget';
import('react-pdf').then(({ pdfjs }) => {
fireAndForget(import('react-pdf').then(({ pdfjs }) => {
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
'pdfjs-dist/build/pdf.worker.min.mjs',
import.meta.url,
).toString();
});
}));
interface Props {
bodyPath?: string;
@@ -56,7 +57,7 @@ export function PdfViewer({ bodyPath, data }: Props) {
externalLinkTarget="_blank"
externalLinkRel="noopener noreferrer"
>
{Array.from(new Array(numPages), (_, index) => (
{Array.from({ length: numPages ?? 0 }, (_, index) => (
<Page
className="mb-6 select-all"
renderTextLayer