diff --git a/src/platform/web/Platform.js b/src/platform/web/Platform.js index 96f76abc..1b08d83d 100644 --- a/src/platform/web/Platform.js +++ b/src/platform/web/Platform.js @@ -80,8 +80,16 @@ function relPath(path, basePath) { async function loadOlmWorker(config) { const workerPool = new WorkerPool(config.worker, 4); await workerPool.init(); - const path = relPath(config.olm.legacyBundle, config.worker); - await workerPool.sendAll({type: "load_olm", path}); + let olmPath = config.olm.legacyBundle; + // convert olm path to absolute path + if (!olmPath.startsWith("/")) { + olmPath = new URL(olmPath, document.location.href).pathname; + console.log("olmPath", config.olm.legacyBundle, olmPath); + } + await workerPool.sendAll({ + type: "load_olm", + path: olmPath + }); const olmWorker = new OlmWorker(workerPool); return olmWorker; } diff --git a/vite.config.js b/vite.config.js index 72c81bac..caae8f4b 100644 --- a/vite.config.js +++ b/vite.config.js @@ -20,6 +20,7 @@ let polyfillRef; export default { public: false, root: "src/platform/web", + base: "./", server: { hmr: false },