browserify-shim

Using browserify with npm jQuery and non-npm plugins

做~自己de王妃 提交于 2019-12-03 05:51:06
问题 I am using browserify to bundle front-end code. It's been great so far, but I've been having difficulty mixing npm and non npm packages. For example, using the npm version of jQuery with non CJS versions of jQuery plugins. My current solution is to use the browser key in package.json to point to jQuery's dist, and then use browserify-shim to add it as a dependency of the plugins. Is there a cleaner way to do this than what I currently have? Edit: I'm currently trying to use npm and package

Browserify with twitter bootstrap

独自空忆成欢 提交于 2019-11-29 19:46:28
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 shim it in, but I am very confused by the shim. I am using jQuery 2.1.1, so I should not need to shim

Howto patch/shim crypto.getRandomValues for React Native

扶醉桌前 提交于 2019-11-29 12:08:32
I am porting some packages created for NodeJS to React Native using ReactNativify to rewrite Node API object dependencies to their browserify equivalents. One of them is crypto . In transformer.js (or .babelrc ) I have: // The following plugin will rewrite imports. Reimplementations of node // libraries such as `assert`, `buffer`, etc. will be picked up // automatically by the React Native packager. All other built-in node // libraries get rewritten to their browserify counterpart. [require('babel-plugin-rewrite-require'), { aliases: { crypto: 'crypto-browserify', // ... },

Howto patch/shim crypto.getRandomValues for React Native

时光毁灭记忆、已成空白 提交于 2019-11-28 06:03:39
问题 I am porting some packages created for NodeJS to React Native using ReactNativify to rewrite Node API object dependencies to their browserify equivalents. One of them is crypto . In transformer.js (or .babelrc ) I have: // The following plugin will rewrite imports. Reimplementations of node // libraries such as `assert`, `buffer`, etc. will be picked up // automatically by the React Native packager. All other built-in node // libraries get rewritten to their browserify counterpart. [require(

Shimming dependencies of dependencies with browserify-shim

风流意气都作罢 提交于 2019-11-27 19:20:30
问题 I'm trying to refactor a library that uses Browserify by shimming certain modules out of the bundle using browserify-shim. Specifically, the library uses require("codemirror") but I want to provide a bundle that doesn't include CodeMirror but will rather use one that is provided via CDN. So I've got browserify-shim config in my package.json like "browserify-shim": { "jquery": "global:jQuery", "codemirror": "global:CodeMirror" } So far so good. require('jquery') and require('codemirror') have