I am running a small piece of code to understand how browserify works. The code is using the json-rpc2 module. I have a file test.js
var rpc = require('json-rpc2')
var client = rpc.Client.$create(8545, 'localhost');
client.call('eth_coinbase', [], function(err, result) {
console.log(result);
}
If I run node test.js
like normal the code runs fine and the output is correctly written to the terminal. However, if I change console.log(result)
to document.write(result)
, browserify it to a file bundle.js
and include it in an HTML file when I run the web page nothing is written to the screen.
Does anyone know what I'm doing wrong? I feel like this is a no-brainer, but I can't figure it out.