browserify-shim

Requiring pickadate.js with Browserify

拜拜、爱过 提交于 2020-01-16 03:39:09
问题 I would like to use the responsive pickadate.js date picker in my Backbone.js application. I am using Browserify to manage modules and dependencies and wondering how to integrate pickadate. I started with a npm install pickadate which added the node module to my project. Then, in one of my views, I try this: var pickadate = require('pickadate'); this.$el.find('input[name=dateEntry]').pickadate(); The error is on the second line which throws this error: [Error] TypeError: 'undefined' is not a

using jquery plugin in browserify along with angular

蓝咒 提交于 2020-01-15 10:15:27
问题 I am trying to use a tooltip plugin called tipso. And I am using angular along with browserify as my dependency manager. I have everything working out for me except for this plugin. Every little thing is little harder in browserify but this one seems to be turning into a nightmare. I have followed the documentation of tipso which is pretty simple. But when I run the app, I keep getting an error message stating that Uncaught TypeError: $(...).tipso is not a function in the chrome console. This

Error using karma-browserify with browserify-shim

一世执手 提交于 2020-01-06 03:55:05
问题 I'm trying to use karma-browserify together with browserify-shim with no success. Here is a repo to reproduce the error: https://github.com/pelizza/karma-browserify-shim PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR TypeError: undefined is not an object (evaluating 'module.exports = ex') at /var/folders/_0/ql88mbyd6v34qsmysr5kf4780000gn/T/e0c5e5ebe3f49930de3d988c7196737f.browserify:40308 <- bower_components/jquery/dist/jquery.js:9837:0 Everything works fine when bundling with browserify, by it seems

How do I properly separate my app.js and vendor.js bundles using Browserify?

冷暖自知 提交于 2020-01-02 08:09:43
问题 My goals are to include the following in my HTML file and have them all work properly: index.html: <script type="text/javascript" src="./vendor.js"></script> <script type="text/javascript" src="./app.js"></script> $(document).ready(function() { // jQuery should be available as `window.$` $(".myclass").doSomethingWithJquery(); } <div class="row"> <h1 class="col-md-3 col-md-offset-3"> I should be able to use bootstrap, including bootstrap's javascript libraries, in my templates </h1> </div> <!-

browserify require in required file cannot find module

自古美人都是妖i 提交于 2019-12-31 04:09:30
问题 I'm trying to package my angular js into a single script using browserify. It works well when I use require from within my main file app.js , but when one of the modules required in app.js contains it's own require , the dependency is not included in my bundle. To recap, in app.js (link to line in repo): require("splash-header"); // more code here splashHeader.js: require("social-button-directive"); // more code here socialButtons.js has no dependencies. browserify --list app.js does not list

Why doesn't this jquery plugin need a shim in order to work?

瘦欲@ 提交于 2019-12-24 02:23:58
问题 Shimming a jQuery plugin appears to be only for geniuses who throw salt over the correct shoulder. However I did this.... var backbone = require('backbone'); global.jQuery = global.$ = backbone.$ = require('jquery'); require('./libs/jquery-modal'); $("body").Modal(); and it just works. (n.b. jquery is being loaded via debowerify) Why does this work? Would shimming it mean I don't need to do the assignments to jquery and $ ? And how is browserify able to handle my plugin code not being in the

Allow global transforms with grunt browserify

只谈情不闲聊 提交于 2019-12-22 12:19:21
问题 I've added jQuery as a script tag in my html file and have added it to package.json for working with browserify-shim as follows: "browserify": { "transform": [ "browserify-shim" ] }, "browserify-shim": { "jquery": "global:jQuery" }, I'm able to expose it in my main script file with a simple require('jquery') call. The problem is that I'm using some jQuery plugins which internally do a require('jquery') and since browserify transforms don't apply to dependency of dependencies, it's causing

Using Browserify with jQuery Plugins

て烟熏妆下的殇ゞ 提交于 2019-12-19 16:49:13
问题 Some brief background: I'm using browserify and browserify-shim (and gulp to build) to create a web app. Prior to this issue, I was require ing jquery from npm so I had no issues. Once I started doing some optimization, I realized how massive the bundle was with jQuery included. So now I'm grabbing jQuery from a CDN with the script tag and placing it before the bundle.js file. But I'm having issues declaring jQuery as a global and properly shimming my jQuery plugins in browserify and

Trouble including slick-carousel with global jQuery using Browserify / Browserify Shim

浪尽此生 提交于 2019-12-12 10:08:12
问题 I'm using Browserify 11.2 and Browserify Shim 3.8 and am attempting to utilize slick-carousel (included via npm) with a jQuery loaded from a CDN. I realize that this requires the use of Browserify shim, but I am unable to get it to work. Here is the relevant portion of my package.json file. "devDependencies": { ... "browserify": "^11.2.0", "browserify-shim": "^3.8.10", ... "slick-carousel": "^1.5.8", ... }, "browserify": { "transform": [ "browserify-shim" ] }, "browser": { }, "browserify-shim

Browserify with twitter bootstrap

南楼画角 提交于 2019-12-12 07:07:53
问题 There are many similar questions including answers here on stack overflow, but none of them have worked for me, so here I am asking you guys. I appreciate everyone's time. I recently started using gulp with browserify, and that works great. I then tried to use browserify for the front-end using: Backbone and Bootstrap3. things are appearing to work, until I try to require the js file that comes with Bootstrap. I get an error in my chrome tools stating: jQuery is undefined. I have attempted to