mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
doc: note ability to require files within packages
Adding note to api/modules.markdown about ability to load arbitrary path from modules from node_module path by adding reference to path after module name in call to require() PR-URL: https://github.com/joyent/node/pull/7794 Reviewed-by: Trevor Norris <trev.norris@gmail.com> Reviewed-by: Fedor Indutny <fedor@indutny.com> Reviewed-by: Timothy J Fontaine <tjfontaine@gmail.com>
This commit is contained in:
committed by
Chris Dickinson
parent
d8a3c4ab2a
commit
fd2226894a
@@ -175,6 +175,12 @@ this order:
|
||||
This allows programs to localize their dependencies, so that they do not
|
||||
clash.
|
||||
|
||||
You can require specific files or sub modules distributed with a module by
|
||||
including a path suffix after the module name. For instance
|
||||
`require('example-module/path/to/file')` would resolve `path/to/file`
|
||||
relative to where `example-module` is located. The suffixed path follows the
|
||||
same module resolution semantics.
|
||||
|
||||
## Folders as Modules
|
||||
|
||||
<!--type=misc-->
|
||||
|
||||
Reference in New Issue
Block a user