browserify

Watson visual recognition run error

こ雲淡風輕ζ 提交于 2019-12-13 16:15:20
问题 I'm trying to set up a visual recognition app using the Watson visual recognition api. To do this I started by downloading watson-developer-cloud and I put it in my node_modules folder, which is next to my index.html and api_request.js. This is my api_request.js file: var watson = require('./node_modules/watson-developer-cloud'); var visual_recognition = watson.visual_recognition({ username: '*********', password: '*********', version: 'v2-beta', version_date: '2015-12-02' }); visual

Gulp and Browserify always giving “dest.write is not a function” error

我的未来我决定 提交于 2019-12-13 07:29:07
问题 I'm trying to utilize Browserify in my Gulp file, but it seems no matter how I set things up, it always throws an error that reads "dest.write is not a function". I originally started with this task using gulp-concat: gulp.task('scripts', function() { return gulp.src(['src/shared/js/one.js', 'src/shared/js/two.js', 'src/shared/js/*.js']) .pipe(browserify() .pipe(concat('main.js')) .pipe(gulp.dest('dist/js')) .pipe(browserSync.stream()); }); When I commented out the browserify() line,

Using browserify with a minified JavaScript library

。_饼干妹妹 提交于 2019-12-13 07:18:28
问题 Can a minified JavaScript library be "required" and bundled using Browserify? In other words, does Browserify require the JavaScript file to be in source format? If a JavaScript file is not a CommonJS module (does not export anything), can it be bundled using Browserify? In other words, What does require('xyz.js') do if xyz.js is not a CommonJS module. 回答1: In case it's properly exporting its properties (e.g. using exports or module.exports) and loading modules using require() then yes. Of

Does Browserify have any limitations?

三世轮回 提交于 2019-12-13 06:11:58
问题 I started to use Browserify today and it is not working too well so far. Are there some modules that cannot be Browserified? I tried searching online for some specifics for a while now but nothing so far. The main problem I have so far is trying to use the getmac module. I wouldn't be surprised if accessing such private info from the browser was impossible, but the following link seems to show otherwise. https://www.npmjs.com/package/getmac The 2 main errors I got so far is the exec command

How to use the new Browserify API?

风格不统一 提交于 2019-12-13 05:24:58
问题 I am currently working on a ReactJS project, so I decided to setup a workflow using Gulp to manage the uglification, minification, JSX transformation and so on. The problem is that the Browserify API is constantly changing (the documentation is not being updated quite often) we can no longer use options inside bundle() As it is stated by the log error message : "Move all option arguments to the Browserify() constructor" But not all the options I am using are available, here is my code for now

ES6 transpiler + browserify + gulp

筅森魡賤 提交于 2019-12-13 05:24:10
问题 I am trying to create a gulp task that takes code generated from the ES6 module transpile (using CJS), and use browserify to turn that into a single file. I have the following code:- var gulp = require('gulp'); var browserify = require('gulp-browserify'); var es6transpiler = require('gulp-es6-module-transpiler'); var rjs = require('gulp-requirejs'); gulp.task('jscompile', function () { gulp.src('./app/scripts/**/*.js') .pipe(es6transpiler({ type : "cjs" })) .pipe(gulp.dest('./dist')) .pipe

Browserify bundle in browser with exports

自作多情 提交于 2019-12-13 02:38:28
问题 How do I access the exports from a Browserify bundle in the browser? Example: // parser.js exports.parse = parse; Then I'm running browserify lib/parser.js -o www/bundle.js Every tutorial/readme I find ends with Drop a single <script> tag into your html and you're done! <script src="bundle.js"></script> But how do I run parse ? The function require isn't defined in the browser. var Parser = require('parser'); Parser.parse('hit kommer vi aldrig'); > Uncaught ReferenceError: require is not

How to export global variable from browserify/babelify to be used in project without browserify?

空扰寡人 提交于 2019-12-13 02:27:37
问题 Scenario: I have 2 projects with quite different setup: Regular website, legacy code with simple gulp setup Small pet project. JS slider plugin written with help of ES6 classes (transpiled with babel). JS gulp task: gulp.task('js', function() { return gulp.src('src/scripts/*.js') .pipe($.plumber()) .pipe(through2.obj(function (file, enc, next) { browserify(file.path, { debug: true }) .transform(require('babelify')) .transform(require('debowerify')) .bundle(function (err, res) { if (err) {

Return value missed within the closure after browserified

风格不统一 提交于 2019-12-13 01:24:37
问题 My original script looks like this: (function() { // result = doSomeWorks() return result; })(); Which I can get a return value from APIs like chrome.tabs.executeScript or execute_script of selenium/webdriver. But after the script being browserified (http://pastebin.com/7dBJuGzL), the return value seems just missed. I always get a null value from the above APIs. Is there any solution/workaround for this? Or maybe trying to get the return value from a browserified script it just not idiomatic

Browserify the node.js http server

二次信任 提交于 2019-12-12 19:18:29
问题 We created a simple js file, intending to find out if http.createServer works on client browser or not: var http = require("http") var server = http.createServer() server.listen(9024, function () { console.log("demo server listening on port 9024") }) and embedded it into a html after browserify. Display the html in chrome, unfortunately, it always fails on line 2 on http.createServer(): "Uncaught Type Error: undefined is not a function" We also played around with "serve-browserify" a bit