Skip to content

Commit

Permalink
module: cjs-module-lexer WebAssembly fallback
Browse files Browse the repository at this point in the history
PR-URL: #43612
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
  • Loading branch information
guybedford authored and richardlau committed Nov 24, 2022
1 parent 625f4bf commit 785dc3e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/internal/modules/esm/translators.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ async function initCJSParse() {
} else {
const { parse, init } =
require('internal/deps/cjs-module-lexer/dist/lexer');
await init();
cjsParse = parse;
try {
await init();
cjsParse = parse;
} catch {
cjsParse = require('internal/deps/cjs-module-lexer/lexer').parse;
}
}
}

Expand Down

0 comments on commit 785dc3e

Please sign in to comment.