browserify

Is it possible to shim Node's fs.readFileSync() in React Native?

坚强是说给别人听的谎言 提交于 2019-12-12 19:06:48
问题 I want to port a number of packages written for NodeJS to React Native. For this purpose I created a RN project using the popular Ignite boilerplate, then used the ReactNativify method and shim Node API objects mostly reusing existing browserify shims. (For details and some useful tips see Can we use nodejs code inside react native application?) Some Node objects are still replaced with empty mocks after transpilation, such as fs . Done in .babelrc as follows: ["module-resolver", { "alias": {

Browserify does not work - why?

人盡茶涼 提交于 2019-12-12 18:24:16
问题 I have the following code that I browserify to bundle.js, that I include (before loading any other .js file) on my front-end. The file I browserify is simply this this: var firebase = require('firebase') I then call authorize() on this variable, in the next file that is included on the front-end, but I get an error saying firebase is not defined? 回答1: Browserify is a module bundler that enables you to use CommonJS (Node) modules in your browser. This implies that your project must follow

Transpile typescript for use in browser

女生的网名这么多〃 提交于 2019-12-12 17:47:02
问题 I am trying to write my frontend code in Typescript and want to export the code, that my browser can load in <script src="..."></script> . I did so by way of browserify and tsify. My trouble is that not on my code is accessible in the global namespace. Loading the script in a <script> tag will execute it, sure, but what if I intend it to be loaded like a library of functions that can be used in inline <script> s or similar? Update An example would be index.ts function foo(): void { console

Browserify Babelify Uglify source map sources do not get loaded in Google Chrome

亡梦爱人 提交于 2019-12-12 17:17:59
问题 I generated a js file with a source map using the following gulp task. The original sources get loaded in Firefox but do not get loaded in Chrome. Can anyone point out why Chrome can't find the sources which are clearly included in the generated index-[hash].js.map? gulp.task('browserify', function () { // set up the browserify instance on a task basis return browserify({ debug: true }) .transform(babelify) .require('client/web/private/js/es6/index.js', { entry: true }) .bundle() .on('error',

Why can I not use a variable as parameter in the require() function of node.js (browserify)?

落爺英雄遲暮 提交于 2019-12-12 15:39:02
问题 I tried something like: var path = '../right/here'; var module = require(path); but it can't find the module anymore this way, while: var module = require('../right/here'); works like a charm. Would like to load modules with a generated list of strings, but I can't wrap my head around this problem atm. Any ideas? 回答1: This is due to how Browserify does its bundling, it can only do static string analysis for requirement rebinding. So, if you want to do browserify bundling, you'll need to

Using greensock with browserify

对着背影说爱祢 提交于 2019-12-12 14:07:11
问题 I'm not able to get TweeLite to work with browserify. I'm an extreme noob when it comes to CommonJS. I've installed gasp v1.13.2 using Bower and include it like this: var TweenLite = require("../../bower_components/gsap/src/minified/TweenLite.min.js"); I don't get any errors when using it, but my animations don't work. According to gsap docs this version should work without a shim. What am I doing wrong? Can anyone provide a working example? https://greensock.com/gsap-1-13-1 I've just started

Require stylesheets and inject them to html as link tag with browserify

不打扰是莪最后的温柔 提交于 2019-12-12 10:37:04
问题 I wanna try using browserify for building my projects. It looks pretty cool that I can require js files using relative paths, then bundle and minify that files alltogether. But it remains unclear to me yet, if I can automatically add that bundle to html as <script src=".../.../bundle.min.js"></script> And, if I can do a similar trick with css - somehow require css files, including vendor ones, bundle and minify that files and inject that bundled css to html head as <link> tag, not <style> .

Browserify “module is not defined”

旧街凉风 提交于 2019-12-12 10:31:58
问题 I am new to browserify. I tried the code below and got Uncaught ReferenceError: module is not defined when loading my web page. Everything is pretty plain and simple so not sure what I am doing wrong: chronoOpenList.js: module.exports = function getChronoOpenList() { var xml = new XMLHttpRequest(); xml.open("GET", "api/nextrequestdue/", true); xml.onreadystatechange = function () { if (xml.readyState === 4 && xml.status === 200) { var jsonText = xml.responseText; parseChronoAndBuildElements

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