Skip to content

Commit

Permalink
apply ast parsing only to node > 16
Browse files Browse the repository at this point in the history
  • Loading branch information
khanayan123 committed Dec 1, 2023
1 parent 45d767f commit 456476f
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function createHook (meta) {
specifiers.set(url.url, specifier)

return {
url: url.format !== 'module' ? addIitm(url.url) : url.url,
url: url.format !== 'module' || NODE_MAJOR < 16 ? addIitm(url.url) : url.url,
shortCircuit: true,
format: url.format
}
Expand Down Expand Up @@ -143,7 +143,7 @@ register(${JSON.stringify(realUrl)}, namespace, set, ${JSON.stringify(specifiers
`
}
}
else if (context.format === 'module') {
else if (context.format === 'module' && NODE_MAJOR >= 16) {
let fileContents
try {
fileContents = fs.readFileSync(fileURLToPath(url), 'utf8')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 456476f

Please sign in to comment.