I will like to add that the tainacan instances are under a multisite installation of Wordpress in 5 diferent websites.
The error displayed on the broser console are:
Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/plain”. Strict MIME type checking is enforced for module scripts per HTML spec. on pdf.mjs:1
viewer.mjs:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of “text/plain”. Strict MIME type checking is enforced for module scripts per HTML spec. on viewer.mjs:1
The recent adoption of .mjs files from the library side is one of the reasons why we decided to move on since it impacts on settings that are not under the plugin control. Here for example this is a misconfiguration error from the server side. It is serving the .mjs file with the wrong MIME type (text/plain instead of application/javascript). Browsers enforce strict MIME type checking for JavaScript modules, so you need to make sure your server is correctly serving .mjs files as JavaScript.
From your side you could try the following, depending on your server configuration:
Apache (.htaccess file or httpd.conf)
Add this line:
AddType application/javascript .mjs
NGINX (nginx.conf)
Inside the server block:
types {
application/javascript mjs;
}
If that does not solve, I tested something risky here but that should work… In the /wp-content/plugins/tainacan-unsecure-legacy-pdfjs/pdfjs-dist/web/viewer.html, line 36, I renamed:
<script src="viewer.mjs" type="module"></script>
To
<script src="viewer.js" type="module"></script>
Then I renamed the actual file /wp-content/plugins/tainacan-unsecure-legacy-pdfjs/pdfjs-dist/web/viewer.mjs to viewer.js. It seems a easier way which could allow us to distribute the plugin like that but I’m not sure if this works on every scenario. Let me know if you go that way!