I can get browserify working but am a little confused about how to access the functions in bundle.js from the DOM.
I have three files-
message.js
module.exports = function (){
return "Hello";
};
main.js
var getMessage = require('./message');
//This shows the alert when script loads
alert(getMessage());
//cannot find this function from index.html
function fnClick(){
alert(getMessage());
}
index.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="js/bundle.js"></script>
</head>
<body>
<button onclick="fnClick();">Click</button>
</body>
</html>
In the browser when the script loads alert(getMessage());
in main.js shows the alert but debugger, fnClick is undefined and I can work the scope.
Thanks