Skip to content

Commit

Permalink
Revert "tests: fix loading wasm when targeting external deps (#94)"
Browse files Browse the repository at this point in the history
This reverts commit bcc6ce4.
  • Loading branch information
guybedford committed Apr 28, 2024
1 parent bcc6ce4 commit 6663bca
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (EXTERNAL_PATH) {
let lazy;
async function init () {
if (!lazy) {
lazy = await import(require('node:url').pathToFileURL(require('node:module').createRequire('${EXTERNAL_PATH}/dist/lexer.js').resolve('./lexer.mjs')));
lazy = await import(require('node:url').pathToFileURL(require('node:module').createRequire('${path.join(EXTERNAL_PATH, 'dist/lexer.js')}').resolve('./lexer.mjs')));
}
module.exports = lazy;
return lazy.init();
Expand Down
7 changes: 1 addition & 6 deletions src/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ function copyLE (src, outBuf16) {
}

const loadWasm = (typeof EXTERNAL_PATH === "string" && (async () => {
return (await import("node:fs/promises"))
.readFile(
(await import("node:url")).fileURLToPath(
import.meta.resolve("../lib/lexer.wasm")
)
);
return (await import('node:fs/promises')).readFile(EXTERNAL_PATH);
})) || (async () => {
const binary = WASM_BINARY
if (typeof window !== "undefined" && typeof atob === "function") {
Expand Down

0 comments on commit 6663bca

Please sign in to comment.