Skip to content

Commit

Permalink
Draco url fix (#5325)
Browse files Browse the repository at this point in the history
* no need for absolute url
  • Loading branch information
slimbuck committed May 12, 2023
1 parent d0f2cc3 commit 059e044
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/framework/parsers/draco-decoder.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { WasmModule } from "../../core/wasm-module.js";
import { ABSOLUTE_URL } from "../asset/constants.js";
import { DracoWorker } from "./draco-worker.js";
import { path } from '../../core/path.js';
import { Debug } from "../../core/debug.js";
import { http } from '../../platform/net/http.js';

Expand Down Expand Up @@ -163,8 +161,8 @@ const initializeWorkers = (config) => {
};
} else {
config = {
jsUrl: '/draco.wasm.js',
wasmUrl: '/draco.wasm.wasm',
jsUrl: 'draco.wasm.js',
wasmUrl: 'draco.wasm.wasm',
numWorkers: defaultNumWorkers
};
}
Expand All @@ -179,12 +177,7 @@ const initializeWorkers = (config) => {
jobQueue = new JobQueue();

// worker urls must be absolute
const absoluteUrl = (url) => {
return ABSOLUTE_URL.test(url) ? url : path.join(new URL(window.location.href).origin, url);
};
const jsUrl = absoluteUrl(config.jsUrl);
const wasmUrl = absoluteUrl(config.wasmUrl);
Promise.all([downloadScript(jsUrl), compileModule(wasmUrl)])
Promise.all([downloadScript(config.jsUrl), compileModule(config.wasmUrl)])
.then(([dracoSource, dracoModule]) => {
// build worker source
const code = [
Expand Down

0 comments on commit 059e044

Please sign in to comment.