Title: Expose `importMetaResolve(url, baseURL)` from `node:module`, and stabilize it · Issue #61127 · nodejs/node · GitHub
Open Graph Title: Expose `importMetaResolve(url, baseURL)` from `node:module`, and stabilize it · Issue #61127 · nodejs/node
X Title: Expose `importMetaResolve(url, baseURL)` from `node:module`, and stabilize it · Issue #61127 · nodejs/node
Description: What is the problem this feature will solve? In Node.js based tools it's common to need to "resolve url X as if it were imported from module Y". Node.js does not expose this as an API, even though it implements it. It only exposes "resol...
Open Graph Description: What is the problem this feature will solve? In Node.js based tools it's common to need to "resolve url X as if it were imported from module Y". Node.js does not expose this as an API, even though ...
X Description: What is the problem this feature will solve? In Node.js based tools it's common to need to "resolve url X as if it were imported from module Y". Node.js does not expose this as an API...
Opengraph URL: https://github.com/nodejs/node/issues/61127
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Expose `importMetaResolve(url, baseURL)` from `node:module`, and stabilize it","articleBody":"### What is the problem this feature will solve?\n\nIn Node.js based tools it's common to need to \"resolve url X as if it were imported from module Y\".\n\nNode.js does not expose this as an API, even though it implements it. It only exposes \"resolve url X as if it were imported from this current module\", through `import.meta.resolve`.\n\nhttps://github.com/wooorm/import-meta-resolve is, for example, a library that is basically code copy\u0026pasted from this repository and published on npm. The annoying part is that, as Node.js resolution rules change, libraries need to change too, and you need to basically check which version of Node.js you are on to know which rules to apply.\n\n### What is the feature you are proposing to solve the problem?\n\nNode.js does have a solution to this: the version of `import.meta.resolve` that takes two arguments, gated behind a flag (`--experimental-import-meta-resolve`). The reason it's behind a flag is because it would be different from the `import.meta.resolve` implementation of browsers, that takes only one argument.\n\nIt'd be great if Node.js could expose the two-args version as an export of `node:module`, something like\n```js\nimport { resolveModuleURL } from \"node:module\"`;\n\nresolveModuleURL(url, parent);\n```\nwith `resolveModuleURL(url, import.meta.url)` being equivalent to `import.meta.resolve(url)`.\n\n### What alternatives have you considered?\n\nThis is related to https://github.com/nodejs/node/pull/55756, which implements a more complex/comprehensive API. ","author":{"url":"https://github.com/nicolo-ribaudo","@type":"Person","name":"nicolo-ribaudo"},"datePublished":"2025-12-19T14:48:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/61127/node/issues/61127"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fabf8998-6f7d-709d-f55c-734b6a5f2e43 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96C6:231C2E:14A2BF6:1D84496:6A4CC71D |
| html-safe-nonce | 9f950c65feee03f72950441aed90896a2e260a4b4a15f3bf2661c9db7a178d9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkM2OjIzMUMyRToxNEEyQkY2OjFEODQ0OTY6NkE0Q0M3MUQiLCJ2aXNpdG9yX2lkIjoiMjY4MjA4NjczMzE1MTc4MjY4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b43f820a6fd02850b708b58f23ae39a073ded39c51bfb8881346db6084841936 |
| hovercard-subject-tag | issue:3747776495 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/61127/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4ff268385574849275c1e0c8a0aa5386800cd4d0d0ebdb2fd9b5d85de887ac6e/nodejs/node/issues/61127 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4ff268385574849275c1e0c8a0aa5386800cd4d0d0ebdb2fd9b5d85de887ac6e/nodejs/node/issues/61127 |
| og:image:alt | What is the problem this feature will solve? In Node.js based tools it's common to need to "resolve url X as if it were imported from module Y". Node.js does not expose this as an API, even though ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nicolo-ribaudo |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d0da0eb92994395299ed4450bf67b0373005be36 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width