I try the example at http://browserify.org/ and try to make a function call like this:
My html:
<!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:
var unique = require('uniq'); var data = [1, 2, 2, 3, 4, 5, 5, 5, 6]; console.log(unique(data)); function hello(){ alert("here"); }
I reviewed main.js -o bundle.js, so I can use it successfully.
But when I click the button, I have an error:
"Uncaught ReferenceError: hello undefined"
Any suggestion would be appreciated!
source share