Skip to content

Commit e3972d2

Browse files
add (temporary) limitation caveat to findPackageJSON doc entry
1 parent 9cef635 commit e3972d2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/module.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,18 @@ added: v23.2.0
8181
* `base` {string|URL} The absolute location (`file:` URL string or FS path) of the
8282
containing module. For CJS, use `__filename` (not `__dirname`!); for ESM, use
8383
`import.meta.url`. You do not need to pass it if `specifier` is an `absolute specifier`.
84-
* Returns: {string|undefined} A path if the `package.json` is found. When `startLocation`
84+
* Returns: {string|undefined} A path if the `package.json` is found. When `specifier`
8585
is a package, the package's root `package.json`; when a relative or unresolved, the closest
86-
`package.json` to the `startLocation`.
86+
`package.json` to the `specifier`.
8787
8888
> **Caveat**: Do not use this to try to determine module format. There are many things effecting
8989
> that determination; the `type` field of package.json is the _least_ definitive (ex file extension
9090
> superceeds it, and a loader hook superceeds that).
9191
92+
> **Caveat**: This currently leverages only the built-in default resolver; if
93+
> [`resolve` customization hooks][resolve hook] are registered, they will not effect the resolution.
94+
> This may change in future.
95+
9296
```text
9397
/path/to/project
9498
├ packages/

0 commit comments

Comments
 (0)