Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

overwrite nodejs built-in javascript libraries

overwrite nodejs built-in javascript libraries

Problem

we need to update lib\buffer.js file to test out https://github.com/strongloop/node/commit/5c94ae11a20a5192e73239e50e5edbbb33e1dc80

I wonder if there is any way to pass new file or file location when starting node exe or do I have to rebuild node binaries?..

Problem courtesy of: Yuri Romanenko

Solution

Per the docs:

Node has several modules compiled into the binary. These modules are described in greater detail elsewhere in this documentation.

The core modules are defined in node's source in the lib/ folder.

Core modules are always preferentially loaded if their identifier is passed to require(). For instance, require('http') will always return the built in HTTP module, even if there is a file by that name.

So yes, you must rebuild the binary.

Solution courtesy of: josh3736

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

overwrite nodejs built-in javascript libraries

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×