Skip to content

Commit

Permalink
try to null getSource export
Browse files Browse the repository at this point in the history
  • Loading branch information
bumblehead committed Nov 6, 2021
1 parent 3304bf5 commit bd2fbde
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/esmockLoader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ export async function load (url, context, defaultGetSource) {
}

// supported by node version less than 16.12
export async function getSource (url, context, defaultGetSource) {
const [ nodeMjr, nodeMnr ] = process.versions.node.split('.').map(Number);
const nodelte1612 = nodeMjr < 16 || (nodeMjr === 16 && nodeMnr <= 12);

async function getSource (url, context, defaultGetSource) {
return load(url, context, defaultGetSource);
}

if (!nodelte1612) {
getSource = null;
}

export { getSource };

0 comments on commit bd2fbde

Please sign in to comment.