Skip to content

Commit 48c12ee

Browse files
committed
.
1 parent 6da3fdd commit 48c12ee

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/components/PdfViewer.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button';
55
import { Input } from '@/components/ui/input';
66
import { ScrollArea } from '@/components/ui/scroll-area';
77

8+
// Configure PDF.js worker
89
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`;
910

1011
interface PdfViewerProps {

vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,19 @@ export default defineConfig({
1919
optimizeDeps: {
2020
exclude: ['lucide-react'],
2121
include: ['react-pdf', 'pdfjs-dist'],
22+
esbuildOptions: {
23+
// Ensure Node.js globals are available
24+
define: {
25+
global: 'globalThis',
26+
},
27+
},
28+
},
29+
worker: {
30+
format: 'es',
31+
plugins: () => [
32+
nodePolyfills({
33+
protocolImports: true,
34+
}),
35+
],
2236
},
2337
});

0 commit comments

Comments
 (0)