vue-pdf-embed icon indicating copy to clipboard operation
vue-pdf-embed copied to clipboard

HMR support broken

Open FossPrime opened this issue 3 years ago • 0 comments

For some reason every time my container module is updated, vue-pdf-embed refuses to load the document. As if it has a memory that it already loaded it, but hasn't actually. To reproduce just make a one line script change, white space works. Vite will then HMR your component and the pdf will not load, despite having a valid URL.

My workaround is to use an objectUrl as source...

const fetchRes = await fetch(this.source)
const pdfBlob = await fetchRes.blob()
this.pdfObjectUrl = window.URL.createObjectURL(pdfBlob) // src
image [Reproduction](https://stackblitz.com/edit/vue-pdf-embed?file=README.md,src%2FApp.vue)

FossPrime avatar Aug 27 '22 00:08 FossPrime