Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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('${path.join(EXTERNAL_PATH, 'dist/lexer.js')}').resolve('./lexer.mjs')));
lazy = await import(require('node:url').pathToFileURL(require('node:module').createRequire('${EXTERNAL_PATH}/dist/lexer.js').resolve('./lexer.mjs')));
}
module.exports = lazy;
return lazy.init();
Expand Down
7 changes: 6 additions & 1 deletion src/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,12 @@ function copyLE (src, outBuf16) {
}

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