Skip to content

Commit

Permalink
fix: Don't use import.meta.resolve
Browse files Browse the repository at this point in the history
import.meta.resolve was unflagged in Node.js 20.6 by
nodejs/node#49028  Unfortunately, the unflagged
version does not support the parentURL argument.  Rather than attempting
to detect whether the argument is supported (which is not as simple as
.length testing) stop using it until a reliable version is unflagged.

Signed-off-by: Kevin Locke <[email protected]>
  • Loading branch information
kevinoid committed Sep 6, 2023
1 parent 86eb4de commit 9045e9e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ function makeResolver() {
// Could use resolve, if/when it supports package.json#exports:
// https://github.com/browserify/resolve/issues/222
// https://github.com/browserify/resolve/pull/224
const resolveTransformer = import.meta.resolve || makeResolver();
//
// import.meta.resolve() was unflagged without the parentURL argument in
// Node.js 20.6.0: https://github.com/nodejs/node/pull/49028
// TODO[engine:node@>=22]: Use import.meta.resolve if it supports parentURL
const resolveTransformer = makeResolver();

async function loadTransformer(name, parent) {
const resolved = await resolveTransformer(name, parent);
Expand Down

0 comments on commit 9045e9e

Please sign in to comment.