mirror of
https://github.com/CyberMind-FR/secubox-deb.git
synced 2026-07-29 13:59:40 +00:00
fix(companion): resolve module view.js import against the page, not /core/ (fixes 'invalid MIME')
Dynamic import() resolves relative to registry.js (/core/), so import('./modules/x/view.js')
hit /core/modules/… → 404 → index.html fallback (HTML) → browser rejected the module
('not a valid JavaScript MIME'). Make m._path an absolute URL via new URL(path, document.baseURI).
SW→v3 to ship past the cached shell.
Co-Authored-By: Gerald KERMA <devel@cybermind.fr>
This commit is contained in:
parent
451270c1ee
commit
ecd32dde65
|
|
@ -24,7 +24,11 @@ export const registry = {
|
|||
const m = await (await fetch(`${base}/${id}/module.json`, { cache: 'no-cache' })).json();
|
||||
m.id = m.id || id;
|
||||
m.module = (m.module || 'MESH').toUpperCase();
|
||||
m._path = `${base}/${id}`;
|
||||
// Absolute URL (resolved against the PAGE), so dynamic import() — which
|
||||
// otherwise resolves relative to this module in /core/ — loads the right
|
||||
// file. Without this, import('./modules/x/view.js') → /core/modules/…
|
||||
// → 404 → index.html (HTML) → "not a valid JS MIME".
|
||||
m._path = new URL(`${base}/${id}`, document.baseURI).href;
|
||||
_mods.set(m.id, m);
|
||||
} catch (e) { console.warn(`[registry] module ${id} failed`, e); }
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// Same-origin app assets → stale-while-revalidate. Box API (cross-origin) →
|
||||
// passthrough (the page handles offline reads/queue).
|
||||
|
||||
const VERSION = 'sbx-companion-v2';
|
||||
const VERSION = 'sbx-companion-v3';
|
||||
const SHELL = [
|
||||
'./', './index.html', './manifest.webmanifest',
|
||||
'./styles/charte.css', './styles/fonts.css',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user