edemaine / coauthor

Coauthor supercollaboration/discussion forum
MIT License
245 stars 32 forks source link

pdfjs via CDN #639

Open edemaine opened 6 months ago

edemaine commented 6 months ago

We currently dynamically import('pdfjs-dist') when displaying the first PDF file. This is good for initial bundle size, but I conjecture that it taxes the server a fair amount (just later instead of earlier). We can fix this like we do with Cocreate, by using a CDN. For example, https://cdn.jsdelivr.net/npm/pdfjs-dist@3.11.174 is 320 kB, so we'd be offloading roughly that much server work for each user.

Similarly, https://cdn.jsdelivr.net/npm/chart.js@2.9.4 is 173kB (but only used in Stats view, so less common)