browserify-shim

karma-browserify coverage reports contain file include paths instead of source code

和自甴很熟 提交于 2019-12-12 03:02:08
问题 Using karma-browserify to do unit tests with Jasmine. The tests correctly run but the coverage reports show file include paths instead of source code. You can reproduce this by installing the following project and run 'gulp unit': https://github.com/bshack/shackstack Here is an example of the coverage report contents: typeof require === "function" && require("/xxx/xxx/xxx/shackstack/app/media/script/service/utilities.js"); Here is my karma.config: module.exports = function(karma) { 'use

Bundling browserified libraries

谁说胖子不能爱 提交于 2019-12-11 17:01:54
问题 I'm having problems finding a canonical approach to building apps with cascading browserified dependencies. I've got a dependency chart that looks something like this: angular --> lib 1 --> lib 2 --> application Both libraries and the app are CommonJS Angular modules. I'd like to bundle each library separately so they can be used independently and/or in non-CJS apps. When I bundle the app, I want to include all upstream deps (angular, lib1, lib2, etc) in a single vendors.js and the

Browserify + shim on jquery and signalR not working

左心房为你撑大大i 提交于 2019-12-11 13:18:00
问题 I'm using gulp + browserify to bundle my source but i got always the same error : jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file. SignalR get $ = undefined... I split my source into two bundle : vendor and app. Vendor bundle get lib's id from packages.json and the bundle require it. App bundle get main entry and i passe id's lib to this bundle with bundle.external. Here my packages.json : "browser": { "angular-notify": "./node_modules

karma-browserify throws error when trying to load modules shimmed with browserify-shim

て烟熏妆下的殇ゞ 提交于 2019-12-11 02:39:35
问题 I know there were similar questions but none of them solved my problem. When I run karma test it throws the following error, every time it tries to load a module, that was shimmed with browserify-shim: TypeError: 'undefined' is not an object (evaluating 'module.exports = ex') at /tmp/8ff1e03f7ba1f9c70ee4192510d267a2.browserify:3855:0 <- lib/underscore/underscore.js:1421:0 My karma.conf.js is the following: module.exports = function(karma) { karma.set({ frameworks: [ 'jasmine', 'browserify' ],

Browserify shim jquery expose doesn't process a lib while working fine on another

霸气de小男生 提交于 2019-12-10 20:45:49
问题 I'm facing a problem with exposing global jquery to several npm loaded non-commonjs libs. I have a following jquery expose config in package.json: "browserify-shim": { "jquery": "global:jQuery", ... And I'm trying to apply this to this datepicker from eonasdan that has a common-js dependency resolving: 'use strict'; if (typeof define === 'function' && define.amd) { // AMD is used - Register as an anonymous module. define(['jquery', 'moment'], factory); } else if (typeof exports === 'object')

After updating xdan/datetimepicker from 2.4.0 to 2.5.4 - $.datetimepicker is undefined

混江龙づ霸主 提交于 2019-12-10 12:06:42
问题 Previously I used "xdan/datetimepicker" v2.4.0. But I needed to upgrade it and after upgrade it doe snot work. It trows: vendor.js:20065 Uncaught TypeError: Unable to process binding "with: function (){return $root.manageView }" Message: Unable to process binding "datetimepicker: function (){return timeFrom }" Message: $element.datetimepicker is not a function There is my "package.json" file: { "name": "App1", "version": "1.0.0", "description": "App1 Testing", "main": "./src/app/app.js",

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

北慕城南 提交于 2019-12-06 08:26:10
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": { "jquery": "global:jQuery", "slick-carousel": { } }, "dependencies": { } When attempting to require

Browserify with Zurb Foundation Framework

两盒软妹~` 提交于 2019-12-06 07:14:07
问题 POST-SOLUTION EDIT Here's a Yeoman generator to scaffold out a project with Foundation and Browserify: https://github.com/dougmacklin/generator-foundation-browserify I'm trying to figure out how to properly bundle the foundation framework js with browserify. In my project folder, I install it along with jQuery (which it depends on): npm install jquery foundation-sites --save Then in my main.js I have the following: var $ = jQuery = require('jquery'); var foundation = require('foundation-sites

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

家住魔仙堡 提交于 2019-12-05 21:42:59
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> <!-- I should be able to use app.js, with its various require('module') statements and attach rendered

Browserify with Zurb Foundation Framework

Deadly 提交于 2019-12-04 14:08:07
POST-SOLUTION EDIT Here's a Yeoman generator to scaffold out a project with Foundation and Browserify: https://github.com/dougmacklin/generator-foundation-browserify I'm trying to figure out how to properly bundle the foundation framework js with browserify . In my project folder, I install it along with jQuery (which it depends on): npm install jquery foundation-sites --save Then in my main.js I have the following: var $ = jQuery = require('jquery'); var foundation = require('foundation-sites'); $(document).foundation(); I include the $ = jQuery = ... because if I don't I get a jQuery is not