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?..
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.
Discussion
View additional discussion.