browserify

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

Can I use both ES6 and ES5 in the same React codebase?

自作多情 提交于 2019-12-11 12:46:12
问题 I have the following gulpfile.js: var gulp = require('gulp'); var browserify = require('gulp-browserify'); var concat = require('gulp-concat'); gulp.task('browserify', function() { gulp.src('js/ScheduleMain.js') .pipe(browserify({transform:'reactify'})) .pipe(concat('ScheduleMain.js')) .pipe(gulp.dest('static/dist/js')); gulp.src('js/ConfidenceMain.js') .pipe(browserify({transform:'reactify'})) .pipe(concat('ConfidenceMain.js')) .pipe(gulp.dest('static/dist/js')); }); gulp.task('default',[

Does ReactJS Support Composed Components With Transitive Version Conflicts?

匆匆过客 提交于 2019-12-11 11:21:10
问题 I'm wondering whether I can build apps with ReactJS and browserify using components that may have child component dependencies with different versions? For example suppose component's A and B are used. Component A depends on component C:1.0.2 and component B depends on Component C:2.0.5. Would a react / browserify build run into issues with this? The reason I'm curious is that the Polymer registry does not support transitive dependencies that have version conflicts: https://github.com/Polymer

ES6 import – jQuery is not defined

大城市里の小女人 提交于 2019-12-11 10:05:44
问题 I'm using Gulp and Browserify for my build process, except I'm having trouble using third party jQuery plugins – showing error jQuery is not defined The following is my file structure. app.js import $ from 'jquery' import plugin from 'jquery-plugin' jquery-plugin.js (function($) { // Plugin code here }(jQuery)); Any ideas? 回答1: Maybe you need use './' import $ from 'jquery' import plugin from './jquery-plugin' EDITED, my new answer below: Try this way: import * as jqueryPlugin from 'jquery

Browserify/Rewireify unit testing, how to inject dependencies without a bundle?

时光怂恿深爱的人放手 提交于 2019-12-11 09:56:14
问题 Browserify handles dependencies nicely by requiring them and creating a bundle where all is in order. When unit testing a module that has it's own dependencies it's somewhat more complicated though. My tests are using mocha , sinon , chai . My app is built on backbone , marionette , and some jQuery plugins. I'm putting it together with grunt and browserify , all is written in coffeescript. For instance, I have a module looking like this: # Global, because swosh won't know what jQuery is

Howto use Node's stream with (or without) Typescript in React Native and VSCode

半城伤御伤魂 提交于 2019-12-11 09:13:01
问题 I am porting some Node-based packages to React Native using ReactNativify (instead of the more 'hacky' rn-nodeify method) to browserify / shim Node API object in the dependency tree. I am developing in VSCode. With ReactNativify you use babel-plugin-rewrite-require in .babelrc (or by using javascript in a rn-cli.config.js + transformer.js ): { ... "plugins": [ ["rewrite-require", { "aliases": { "constants": "constants-browserify", "crypto": "react-native-crypto", "dns": "node-libs-browser

Generating both browserify output & System.register() modules from ES6 modules?

∥☆過路亽.° 提交于 2019-12-11 09:07:55
问题 I have coded ES6 modules as per 2ality's final syntax example, without a .js suffix. I have as well organised the modules into a vendor/project directory hierarchy and module naming scheme as System.register() module format effectively places registered modules into the same namespace. The problem is as follows, if I quote 2ality's example: //------ lib.js ------ export const sqrt = Math.sqrt; export function square(x) { return x * x; } export function diag(x, y) { return sqrt(square(x) +

How to set the module name or path used in require() calls of a module in browserify?

喜欢而已 提交于 2019-12-11 05:56:19
问题 I am using browserify to move a reusable typescript module into the browser using gulp. gulp.task("default", function(){ return browserify({ basedir: '.', debug: true, require: ['./src/common/common.ts'], fullPaths: false, cache: {}, packageCache: {} }).plugin(tsify) .bundle() .pipe(source('common.js')) .pipe(gulp.dest("dist")); }); To my surprise I need to include the resulting common.js file via require("c:\\Users\\Luz\\Desktop\\tstest\\client\\src\\common\\common.ts"); In typescript or in

Angular 2 with babel ES2015 not loading and no error

谁说我不能喝 提交于 2019-12-11 05:54:36
问题 I'm trying to use angular 2 with babel, grunt, browserify and ES2015 sources. I'm trying a very basic example of simply loading a component with its template into my document. The build run fine and the bundle is created with no error but when loaded nothing happens and I get no error in the console making it hard to debug. I've spent a lot of time trying to figure it out and based from examples I could find online my configuration seemed ok but if it doesn't work clearly I got something

why browserify build gives error for react build?

自闭症网瘾萝莉.ら 提交于 2019-12-11 05:00:11
问题 i have the following codes , a sample project i done. PlayerWrapper.js import React from 'react' import Player from './Player' class PlayerWrapper extends React.Component { render() { return ( <div> <h3>before player</h3> <Player /> <h3>after player</h3> </div> ) } } export default PlayerWrapper Player.jS import React from 'react' class Player extends React.Component { render(){ return( <div><h1>How are you from Player</h1></div> ) } } export default Player in the package.json i have the