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 targos committed Jul 12, 2022
1 parent 7491469 commit e914185
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 @@ -61,8 +61,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 e914185

Please sign in to comment.