Static variables
staticread onlycache:DynamicAccess<Module>
Modules are cached in this object when they are required.
By deleting a key value from this object, the next require
will reload the module.
This does not apply to native addons, for which reloading will result in an error.
See also:
staticread onlyextensions:DynamicAccess<Dynamic>
Instruct require on how to handle certain file extensions.
Deprecated: In the past, this list has been used to load non-JavaScript modules into Node by compiling them on-demand. However, in practice, there are much better ways to do this, such as loading modules via some other Node program, or compiling them to JavaScript ahead of time.
Since the Module
system is locked, this feature will probably never go away. However, it may have subtle bugs
and complexities that are best left untouched.
staticread onlymain:Module
The Module
object representing the entry script loaded when the Node.js process launched.
See "Accessing the main module".
See also:
Static methods
staticrequire(id:String):Dynamic
Used to import modules, JSON
, and local files.
Modules can be imported from node_modules
.
Local modules and JSON files can be imported using a relative path (e.g. ./
, ./foo
, ./bar/baz
, ../foo
)
that will be resolved against the directory named by __dirname
(if defined) or the current working directory.
See also:
staticresolve(module:String, ?options:Null<RequireResolveOptions>):String
Use the internal require()
machinery to look up the location of a module,
but rather than loading the module, just return the resolved filename.
See also: