Init fix.
This commit is contained in:
parent
d31ef57131
commit
0d723d3e05
@ -22,7 +22,8 @@ let initPromise = null;
|
|||||||
*/
|
*/
|
||||||
export function zstdInit() {
|
export function zstdInit() {
|
||||||
if (!initPromise) {
|
if (!initPromise) {
|
||||||
initPromise = init();
|
const wasmUrl = `${self.docURL}/assets/zstd.wasm`;
|
||||||
|
initPromise = init(wasmUrl);
|
||||||
}
|
}
|
||||||
return initPromise;
|
return initPromise;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,6 +99,10 @@ module.exports = {
|
|||||||
context: "node_modules/node-forge/dist",
|
context: "node_modules/node-forge/dist",
|
||||||
from: "prime.worker.min.js",
|
from: "prime.worker.min.js",
|
||||||
to: "assets/forge/"
|
to: "assets/forge/"
|
||||||
|
}, {
|
||||||
|
context: "node_modules/@bokuweb/zstd-wasm/dist/web/",
|
||||||
|
from: "zstd.wasm",
|
||||||
|
to: "assets/"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
@ -110,6 +114,17 @@ module.exports = {
|
|||||||
operations: [
|
operations: [
|
||||||
new ReplaceOperation("once", "if (pixelSize < elementMinSize)", "if (false)")
|
new ReplaceOperation("once", "if (pixelSize < elementMinSize)", "if (false)")
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// @bokuweb/zstd-wasm's init() unconditionally evaluates
|
||||||
|
// `new URL("./zstd.wasm", import.meta.url)` before checking
|
||||||
|
// whether a path was passed in. Webpack's `publicPath: ""`
|
||||||
|
// makes that base URL invalid and the constructor throws.
|
||||||
|
// Neuter the offending line; we always pass a path from Zstd.mjs.
|
||||||
|
test: /@bokuweb[\/\\]zstd-wasm[\/\\]dist[\/\\]web[\/\\]index\.web\.js$/,
|
||||||
|
operations: [
|
||||||
|
new ReplaceOperation("once", "new URL(`./zstd.wasm`, import.meta.url).href", "''")
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user