Hi @amikumar36 , welcome to the forum.
I’m not sure about RequireJS.
However the previewer loads a bunch of 3rd party libraries when it tries preview a document. Typically each file type does have it’s own previewer.
Check the browser console to see if it is trying to load something that it can’t find.
Also try with pure simple text document and see if there is any difference.
Hope this helps
Cheers
Here is an example codepen in which several files are opening like .txt, .jpg while cannot preview some extensions:
Also console shows no error, all dependency library files are loaded properly in Developer Tool > Network tab.
Hi @amikumar36
Doing a test for .PDF’s, it is definitely missing the pdf viewer worker process.
Let’s compare both options:
Without Require.js, previewing the “book sample.pdf”, we can see that an extra script is loaded.
This does not happen with the Require.js:
Somehow require.js is preventing that extra script from being loaded.
Hi @rbarbosa,
Yes I definitely observed that.
Is there any possible solution to rectify this issue as I have RequireJS included in my application to load required JS files for each module. It is nearly impossible for me to remove RequireJS from my application as lot of modules are dependent on it.
I appreciate your help and also thanks for your response!
Hi @amikumar36 ,
I’ll ask my internal folks, see what they have to say, but this might take a bit of time.
On your side, and since I’m not familiar with requireJs, is their community aware of such odd behavior?
Cheers
Hi @rbarbosa,
There is no open/closed issue reported on RequireJS Github repository regarding this scenario as per my knowledge. I suspect it has something to do with the scripts getting loaded for PDF preview. The pdfjsLib and pdfjsViewer properties are resolving to an undefined value. Also I am not able to control the preview.js, pdf.min.js, pdf_viewer.min.js and exif.min.js as these JS files are loaded from Box CdnJS domain (http://cdn01.boxcdn.net/).
It would be of great help if you could help me connect with someone from the developer/technology team.
Thanks
Yes, that pdf service worker is not getting loaded and registered.
Is there no RequireJS documentation related to when loaded scripts load other scripts?
Something like cascade loading?
Also, I’ve pinged the team, let’s see what they have to say, but it might take a while.