I am trying to figure out what the difference between browserify and browserify-shim. After reading a few tutorial, the only difference I found that is to make required function or libraries to global scope?
browserify makes all js files to one single file without dependency conflict or issues.
var $ = require('jquery');
$('body').css('background','red');
browserify main.js -o bundle.js
so we can just include bundle.js in html file, but we are unable to use $ in html, as jQuery is not in global environment.
browserify-shim is for making jQuery to global scope?
"browserify-shim": {
"jquery": "$"
}
But if only for making jQuery to global scope, I think we can simply done by using this
var $ = window.jQuery = require("jquery"); in browserify
So my question is that, do we really need browserify-shim or if there is something else we need from browserify-shim but we are unable to do it though browserify?