Init fix.
This commit is contained in:
parent
d31ef57131
commit
0d723d3e05
@ -22,7 +22,8 @@ let initPromise = null;
|
||||
*/
|
||||
export function zstdInit() {
|
||||
if (!initPromise) {
|
||||
initPromise = init();
|
||||
const wasmUrl = `${self.docURL}/assets/zstd.wasm`;
|
||||
initPromise = init(wasmUrl);
|
||||
}
|
||||
return initPromise;
|
||||
}
|
||||
|
||||
@ -99,6 +99,10 @@ module.exports = {
|
||||
context: "node_modules/node-forge/dist",
|
||||
from: "prime.worker.min.js",
|
||||
to: "assets/forge/"
|
||||
}, {
|
||||
context: "node_modules/@bokuweb/zstd-wasm/dist/web/",
|
||||
from: "zstd.wasm",
|
||||
to: "assets/"
|
||||
}
|
||||
]
|
||||
}),
|
||||
@ -110,6 +114,17 @@ module.exports = {
|
||||
operations: [
|
||||
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