forked from mystiq/hydrogen-web
make olmPath absolute if it isn't already
This commit is contained in:
parent
9a3f74c6fb
commit
155cd4c9bd
2 changed files with 11 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ let polyfillRef;
|
|||
export default {
|
||||
public: false,
|
||||
root: "src/platform/web",
|
||||
base: "./",
|
||||
server: {
|
||||
hmr: false
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue