browserify

How to use my own version of jQuery with browserified modules

这一生的挚爱 提交于 2019-12-02 13:48:23
问题 (I should clarify up front: My question is about closures and client module patterns in Javascript. It's not about how to use jQuery.noConflict().) I've got a bit of Javascript that people can add to their websites. I want my own code to have access to a $ variable which resolves to a specific version of jQuery that's independent of whatever the page has loaded. This is easy if all my code is in a single file, inside a closure that I define. But I'm struggling to find a clean way to do this

Gulp Browserify SourceMaps

▼魔方 西西 提交于 2019-12-02 11:35:40
问题 I've looked at this question already and the answer doesn't work in my situation: gulp, browserify, maps? So here is what I have: gulp.task('debug-app-js', function () { console.log('DEBUG-APP-JS'); var src = './node_modules/js/app-main.js', dst = '../www/js', bundler = browserify(src, {debug:true}); return bundler.bundle() .pipe(source('app-build.js')) .pipe(gulp.dest(dst)) }); Debug is set to true, so why don't I get any sourcemaps? UPDATE: It appears to be an IE problem as the sourcemaps

NodeJS with webpack jQuery.Deferred exception: o(…).select2 is not a function TypeError: o(…).select2 is not a function

和自甴很熟 提交于 2019-12-02 09:29:40
I'm modifying my application to use nodejs and browserify via gulp to produce one minified js. I've switched from loading dependencies manually and updating manually to installing them with npm. Everything went smooth, but when I wanted to install select2 it started throwing errors all over the place. When I moved my removed manual updated file for the npm required() file. jquery.js:3841 jQuery.Deferred exception: o(...).select2 is not a function TypeError: o(...).select2 is not a function at i.init ( https://www.example.com/newstyle/js/closure.js?time=1559747711:1:5612 ) at i.sysInit ( https:

How to test browserify project using karma/jasmine

帅比萌擦擦* 提交于 2019-12-02 08:32:03
问题 I'm totally new to the concept of testing, and i need one solid example on how to do it in my project: I have a gulp file goes like this (Not all of it, just the important portions) gulp.task('bundle', function() { gulp.src('public/angular-app/main.js') .pipe(browserify({ debug: true })) .pipe(gulp.dest('public/min-js')); }); This is a slight portion of my main.js: 'use strict'; angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ngSanitize', 'ngFx', ... ], ['$interpolateProvider',

How to test browserify project using karma/jasmine

眉间皱痕 提交于 2019-12-02 07:29:14
I'm totally new to the concept of testing, and i need one solid example on how to do it in my project: I have a gulp file goes like this (Not all of it, just the important portions) gulp.task('bundle', function() { gulp.src('public/angular-app/main.js') .pipe(browserify({ debug: true })) .pipe(gulp.dest('public/min-js')); }); This is a slight portion of my main.js: 'use strict'; angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ngSanitize', 'ngFx', ... ], ['$interpolateProvider', function($interpolateProvider) { $interpolateProvider.startSymbol('{{'); $interpolateProvider.endSymbol('}}')

Use of browserify to pack React components

眉间皱痕 提交于 2019-12-02 05:36:24
问题 I am trying to learn browserify to manage my javascript. My first simple task is to create a react.js file which will be generated by gulp + browserify var browserify = require('gulp-browserify'); gulp.task('browserify-react', function () { return gulp.src('js/react/react.js') .pipe(browserify()) .pipe(rename('react-generated.js')) .pipe(gulp.dest('./dist')); }); In js/react/ I created a file react.js which is just two require commands: var React = require('react'); var ReactDOM = require(

Is it possible to browserify the “tedious” module so that the nodejs program can be run in the browser?

只谈情不闲聊 提交于 2019-12-02 05:13:50
问题 I'm a beginner to Node.js and I'm currently building a Node.js program that accesses and queries a Microsoft Azure SQL database with the "tedious" module (see code below) and puts the data onto a html webpage. I want to run this code in a browser so I used browserify to bundle the modules together. However, when this code is run in Google Chrome, the following error is returned: require is not defined. Is there a fix? Is it even possible to use the tedious module in Chrome? If it isn't

Gulp Browserify SourceMaps

◇◆丶佛笑我妖孽 提交于 2019-12-02 04:51:46
I've looked at this question already and the answer doesn't work in my situation: gulp, browserify, maps? So here is what I have: gulp.task('debug-app-js', function () { console.log('DEBUG-APP-JS'); var src = './node_modules/js/app-main.js', dst = '../www/js', bundler = browserify(src, {debug:true}); return bundler.bundle() .pipe(source('app-build.js')) .pipe(gulp.dest(dst)) }); Debug is set to true, so why don't I get any sourcemaps? UPDATE: It appears to be an IE problem as the sourcemaps are appearing in Chrome and Firefox. But it's strange because I was getting sourcemaps in IE with my

How to use my own version of jQuery with browserified modules

橙三吉。 提交于 2019-12-02 03:51:12
(I should clarify up front: My question is about closures and client module patterns in Javascript. It's not about how to use jQuery.noConflict().) I've got a bit of Javascript that people can add to their websites. I want my own code to have access to a $ variable which resolves to a specific version of jQuery that's independent of whatever the page has loaded. This is easy if all my code is in a single file, inside a closure that I define. But I'm struggling to find a clean way to do this using a module pattern where my code is in separate closures. Background (i.e. the obvious thing which

Is it possible to browserify the “tedious” module so that the nodejs program can be run in the browser?

≯℡__Kan透↙ 提交于 2019-12-02 02:35:01
I'm a beginner to Node.js and I'm currently building a Node.js program that accesses and queries a Microsoft Azure SQL database with the "tedious" module (see code below) and puts the data onto a html webpage. I want to run this code in a browser so I used browserify to bundle the modules together. However, when this code is run in Google Chrome, the following error is returned: require is not defined. Is there a fix? Is it even possible to use the tedious module in Chrome? If it isn't possible, do I need to use an intermediate server between the Node.js application and the webpage? var