How do I set a dependency to jquery with browserify and gulp -


so i'm using gulp , browserify , i'm requiring jquery , plugin (owl-carousel) needs jquery dependency.

however order of files seems messed query compiled final js file after plugin i'm using results in console error:

uncaught typeerror: cannot read property 'fn' of undefined 

how tell browserify there dependency? need browserify-shim or there way?

my includes:

var $             = require('jquery'),     owlcarousel   = require('./vendor/owl.carousel/owl.carousel.js'); 

i'm using browserify-shim getting same error. what's in package.js:

  "browser": {     "jquery": "./vendor/jquery/jquery.js",     "owlcarousel": "onedirection/static/js/vendor/owl.carousel/owl.carousel.js"   },   "browserify-shim": {     "jquery": "$",     "owlcarousel": {       "exports": "owlcarousel",       "depends": [         "jquery:jquery"       ]     }   } 

anyone got ideas?

there trick use jquery( $ ) globally on build version:

global.$ = require('jquery'); 

and in package.json

"browserify-shim": {     "jquery": {       "exports": "$"     }   } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -