Exporting and Consuming Modules

suggest change

Remarks

While everything in Node.js is generally done asynchronously, require() is not one of those things. Since modules in practice only need to be loaded once, it is a blocking operation and should be used properly.

Modules are cached after the first load. In development, delete that entry from require.cache before requiring the file again, or Node.js keeps the old exports. Clearing the cache does not drop a copy that other code still holds. Avoid doing this in production.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents