I'm trying to load jquery + jquery-ui + bootstrap inside my project throught NPM and gulp.
My configuration is this:
Package.json
"browser": { "jquery": "/node_modules/jquery/dist/jquery.js", "jquery-ui": "/node_modules/jquery-ui-browserify/jquery-ui.js" }, "browserify-shim": { "jquery": "$", "jquery-ui": { "exports": "jquery-ui", "depends": [ "jquery:jQuery" ] } }, "browserify": { "transform": [ "browserify-shim" ] }, "dependencies": { "bootstrap": "^3.3.6", "jquery": "2.1.0", "jquery-ui-browserify": "^1.11.0-pre-seelio", } gulpfile.js
gulp.task('browserify', function(){ return browserify([ 'node_modules/jquery/dist/jquery.js', 'node_modules/jquery-ui-browserify/dist/jquery-ui.js', 'node_modules/bootstrap/dist/js/bootstrap.js', ]) .bundle() .pipe(source('core.js')) .pipe(buffer()) .pipe(gulp.dest('build/js')); }); Then I load core.js with assetic from my index.php but I get this error:
Uncaught ReferenceError: jQuery is not defined What am I doing wrong?
Thank you.
jquery-browserifysolves the problemnpm install jquery-browserify --save. Worked for me.jqueryandjquery-ui-browserify.