Using Bootstrap 3.0 with Browserify -


I am trying to use Bootstrap 3.0 with browser 5.9.1, but am receiving the following error:

  Uncaught ReferenceError: jQuery is not defined  

What is the correct way to do this?

Here are the relevance parts of my package. Jason:

  {...} "script": {"bundle": "Browser men.js-o bundle.js - debug -list"}, "dependency": {"backbone ":" ~ 1.1.x "," jquery ":" ~ 2.1.x "," underscore ":" ~ 1.6.x "}," devDependencies ": {" browserify ":" ^ 5.9.1 ", .. .},. ..}  

Module which requires bootstrap is shown below:

  var $ = required ('jquery'); Var BABON = Required ('backbone'); Backbone $ = $; Required ('../../../../ bower_components / bootstrap-saas-government / assets / javascripts / bootstrap');  

Two things that I do not like are here:

  1. Downloaded using bootstrap bover There is no way to use AFAIK NPM. What makes this path very long and weird is there any way to make bootstrap NPM friendly?
  2. Bootstrap is not a direct dependency of this module, it's like a jQuery plugin when it loads, then it simply creates some event handlers on the document to handle events from bootstrap vistas. All I need is to make these event handlers. Is this the right way? Certainly after this, I'm still pulling my hair out "I do not define jQuery" error I'm trying to make this work please help!

    PS Before that I had a tight browser plugin in the picture and quickly realized that this browserfif was not used with version 4.x with any source map capability. It was also difficult to debug, so I took it out of the picture and ran the browser browsing directly from NPM.

This works for me when I am using Bootstrap in the browser:

  window. $ = Window.jQuery = require ('jquery') var baibon = ('backbone'); Backbone $ = $; Required ('../../../../ bower_components / bootstrap-saas-government / assets / javascripts / bootstrap');  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -