I am having no problem with browserification, by the way my module is super simple. Like this:
//sum.js
module.exports = function(a, b){
return a + b;
}
So I use the command browserify -r ./sum | uglifyjs -c -m --output sum.min.js and everything is ok.
If I copy paste the results in chromes console, the only way I can retrieve the sum module is by doing var sum = require("./sum") which I believe is not that friedly.
I would be happy if I could just var sum = require("sum") (without the './' part).
Is it possible? I cant seem to find anything on browserify docs.
browserify -r ./src/HelloWorld.js:hola
And then in the client code simply:
var hola = require('hola');
Covered briefly in the docs and command-line help:
--require, -r A module name or file to bundle.require() Optionally use a colon separator to set the target.