Skip to content

Commit 62c8948

Browse files
es128jasnell
authored andcommitted
doc: fix Folders as Modules omission of index.json
This section was inconsistent with the actual behavior of `require` and with other parts of this same document, which do describe the ability to treat index.json as a module’s default file. PR-URL: nodejs/node-v0.x-archive#8868 Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
1 parent 6502160 commit 62c8948

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

doc/api/modules.markdown

+3-2
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,13 @@ If this was in a folder at `./some-library`, then
197197

198198
This is the extent of Node's awareness of package.json files.
199199

200-
If there is no package.json file present in the directory, then node
201-
will attempt to load an `index.js` or `index.node` file out of that
200+
If there is no package.json file present in the directory, then node will
201+
attempt to load an `index.js`, `index.json`, or `index.node` file out of that
202202
directory. For example, if there was no package.json file in the above
203203
example, then `require('./some-library')` would attempt to load:
204204

205205
* `./some-library/index.js`
206+
* `./some-library/index.json`
206207
* `./some-library/index.node`
207208

208209
## Caching

0 commit comments

Comments
 (0)