Skip to content

Commit

Permalink
doc: fix Folders as Modules omission of index.json
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
es128 authored and jasnell committed Aug 29, 2015
1 parent 6502160 commit 62c8948
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/modules.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,13 @@ If this was in a folder at `./some-library`, then

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

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

* `./some-library/index.js`
* `./some-library/index.json`
* `./some-library/index.node`

## Caching
Expand Down

0 comments on commit 62c8948

Please sign in to comment.