Skip to content

Commit

Permalink
dev(pkg::core): more elegant way to escape import
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Sep 27, 2023
1 parent 996f2a1 commit 1524693
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/tools/wasm-debundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export * from './${fileName}';
export default _default;
let nodeJsImportWasmModule = async function(wasm_name, url) {
const escape_import = t => import(t);
const path = await escape_import('path');
const { readFileSync } = await escape_import('fs');
const escapeImport = new Function('m', 'return import(m)');
const path = await escapeImport('path');
const { readFileSync } = await escapeImport('fs');
const wasmPath = new URL(path.join(path.dirname(url), wasm_name));
return await readFileSync(wasmPath).buffer;
Expand Down

0 comments on commit 1524693

Please sign in to comment.