You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Document and Page components dynamically import internal Document and Page components, for compatibility with SvelteKit, this was done to avoid having to do it in the consumer.
However, people using the lib would probably not use the Document and Page components directly, instead create their own PDFViewer component using these. In which case, dynamically importing them in the consumer wouldn't really be that big of a deal.
So, is it really necessary to do the dynamic imports within the library?
The text was updated successfully, but these errors were encountered:
For, Document it seems that something recently changed somewhere either in Vite, PDFJS or the adapters which now allow PDFJS to be imported statically without any onMount shenanigans,
however, the worker initializer must not be called on the server otherwise it'll crash, so Document needs to be wrapped in a {#if} browser check for sveltekit. This is a lot more concise than onMount and it allows us to avoid needing to have a wrapper component, combined with possible use cases mentioned in the first comment, I think this is a worthwhile tradeoff
Will keep the issue open still for the abstraction in Page
Currently, the Document and Page components dynamically import internal Document and Page components, for compatibility with SvelteKit, this was done to avoid having to do it in the consumer.
However, people using the lib would probably not use the Document and Page components directly, instead create their own PDFViewer component using these. In which case, dynamically importing them in the consumer wouldn't really be that big of a deal.
So, is it really necessary to do the dynamic imports within the library?
The text was updated successfully, but these errors were encountered: