I am trying example in http://browserify.org/ and try to make a function call as follows:
My html is:
<!DOCTYPE html>
<html>
<head>
<title>Test Browserify</title>
<script src="bundle.js"></script>
</head>
<body>
<button onclick="hello()">test</button>
</body>
</html>
and my javascript is:
var unique = require('uniq');
var data = [1, 2, 2, 3, 4, 5, 5, 5, 6];
console.log(unique(data));
function hello(){
alert("here");
}
I did browserify main.js -o bundle.js, so I can use require successfully.
But when I click the button, I have the error:
"Uncaught ReferenceError: hello is not defined"
Any suggestion will be appreciated!