Skip to content

Commit

Permalink
doc: pass path in URL constructor
Browse files Browse the repository at this point in the history
PR-URL: #28161
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
  • Loading branch information
dnalborczyk authored and targos committed Jun 18, 2019
1 parent bd16f9b commit 694faf1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions doc/api/esm.md
Expand Up @@ -467,8 +467,7 @@ The resolve hook returns the resolved file URL and module format for a
given module specifier and parent file URL:
```js
const baseURL = new URL('file://');
baseURL.pathname = `${process.cwd()}/`;
const baseURL = new URL(`${process.cwd()}/`, 'file://');

export async function resolve(specifier,
parentModuleURL = baseURL,
Expand Down Expand Up @@ -511,8 +510,7 @@ import Module from 'module';
const builtins = Module.builtinModules;
const JS_EXTENSIONS = new Set(['.js', '.mjs']);

const baseURL = new URL('file://');
baseURL.pathname = `${process.cwd()}/`;
const baseURL = new URL(`${process.cwd()}/`, 'file://');

export function resolve(specifier, parentModuleURL = baseURL, defaultResolve) {
if (builtins.includes(specifier)) {
Expand Down

0 comments on commit 694faf1

Please sign in to comment.