Which page loads your script depends on mount:
- /plugins
Loads plugin.js when: mount is "settings" (default)
Your UI: visible card
- /files
Loads plugin.js when: mount is "files"
Your UI: visible card below the file list. JSZip is preloaded (window.JSZip) before the first plugin loads.
- /plugins-run
Loads plugin.js when: always (any mount)
Your UI: rendered into a hidden container (display:none)
On /plugins, a files plugin gets a small info card saying it appears on the File Manager page. On other pages JSZip is not preloaded:
if (typeof JSZip === 'undefined') {
await new Promise((ok, fail) => {
const s = document.createElement('script');
s.src = '/js/jszip.min.js'; s.onload = ok; s.onerror = fail;
document.head.appendChild(s);
});
}
Design for /plugins-run: your render function also runs there, invisibly, so registered actions can be executed. Don't start long work automatically at render time. Wait for a button click or an action.