V
V
vohaha2015-10-09 12:04:17
JavaScript
vohaha, 2015-10-09 12:04:17

How to explicitly specify dependencies in browserify?

Include browserify with jQuery, perfect scrollbar, jQuery ui and bootstrap-sass

var $, Ps, jQuery;

$ = jQuery = require('jquery');

Ps = require('perfect-scrollbar');

require('jquery-ui/slider');

require('bootstrap-sass');

But when loading the page it gives an error
Uncaught Error: Bootstrap's JavaScript requires jQuery

leads to this place
if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

Am I doing something wrong? Is it possible to explicitly specify the dependencies somehow?
PS I started getting an error after I rewrote it to coffeescript.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2015-10-09
@vohaha

Bootstrap doesn't seem to work with CommonJS. Try something like this:

var $ = window.jQuery = require('jquery');
require('bootstrap-sass');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question