@@ -329,6 +329,9 @@ added:
329329 - v13.9.0
330330 - v12.16.2
331331changes:
332+ - version: 20.6.0
333+ pr-url: https://github.com/nodejs/node/pull/49028
334+ description: No longer behind the ` --experimental-import-meta-resolve` flag.
332335 - version: v20.0.0
333336 pr-url: https://github.com/nodejs/node/pull/44710
334337 description: This API now returns a string synchronously instead of a Promise.
@@ -348,36 +351,35 @@ changes:
348351
349352* ` specifier` {string} The module specifier to resolve relative to the
350353 current module.
351- * Returns: {string} The absolute ( ` file: ` ) URL string for the resolved module .
354+ * Returns: {string} The absolute URL string that the specifier would resolve to .
352355
353356[` import.meta.resolve` ][] is a module-relative resolution function scoped to
354357each module, returning the URL string.
355358
356359` ` ` js
357360const dependencyAsset = import .meta.resolve(' component-lib/asset.css' );
358361// file:///app/node_modules/component-lib/asset.css
362+ import .meta.resolve(' ./dep.js' );
363+ // file:///app/dep.js
359364` ` `
360365
361366All features of the Node.js module resolution are supported. Dependency
362367resolutions are subject to the permitted exports resolutions within the package.
363368
364- ` ` ` js
365- import .meta.resolve(' ./dep' , import.meta.url);
366- // file:///app/dep
367- ` ` `
369+ **Caveats**:
368370
369- > **Caveat** This can result in synchronous file-system operations, which
370- > can impact performance similarly to ` require .resolve ` .
371+ * This can result in synchronous file-system operations, which
372+ can impact performance similarly to ` require .resolve ` .
373+ * This feature is not available within custom loaders (it would
374+ create a deadlock).
371375
372- Previously, Node.js implemented an asynchronous resolver which also permitted
373- a second contextual argument. The implementation has since been updated to be
374- synchronous, with the second contextual ` parent` argument still accessible
375- behind the ` -- experimental- import -meta-resolve` flag:
376+ **Non-standard API**:
376377
377- * ` parent ` {string|URL} An optional absolute parent module URL to resolve from.
378+ When using the ` -- experimental- import -meta-resolve` flag, that function accepts
379+ a second argument:
378380
379- > **Caveat** This feature is not available within module customization hooks (it
380- > would create a deadlock).
381+ * ` parent ` {string|URL} An optional absolute parent module URL to resolve from.
382+ **Default:** ` import.meta.url `
381383
382384## Interoperability with CommonJS
383385
0 commit comments