Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Created January 23, 2014 17:54
Show Gist options
  • Save apaleslimghost/8583452 to your computer and use it in GitHub Desktop.
Save apaleslimghost/8583452 to your computer and use it in GitHub Desktop.
Potentially useful browserify transform

Config

{
	"jquery": {
		"commonjs": "jquery-browser",
		"requirejs": "jquery",
		"global": "jQuery"
	}
}

Source

var $ = require('jquery');

Transformed to

var $ = 'object' === typeof exports ? require('jquery-browser') : 'function' === typeof define && define.amd ? require('jquery') : window.jQuery;

Also happens

bundle.external('jquery-browser')
bundle.exclude('jquery')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment