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
Post a Comment