since gulp-browserify module is blacklisted I`ve tried to rewrite my old code in gulpfile.js without gulp-browserify.
I have this worked task with gulp-browserify
var gulp = require('gulp'),
browserify = require('gulp-browserify');
gulp.task('browserify', function() {
return gulp.src('./lib/tssoftmons.js')
.pipe(browserify({
ignore: ['jsdom']
}))
.pipe(gulp.dest('./dist/'))
});
as you see I tell gulp-browserify to ignore require('jsdom') in browserifying.
After gulp-browserify was uninstalled I instal browserify module and rewrite code
var gulp = require('gulp'),
browserify = require('browserify');
gulp.task('browserify', function() {
var b = browserify();
b.ignore('jsdom');
b.add('./lib/tssoftmons.js');
return b.bundle()
.pipe(gulp.dest('./dist/'));
});
And get this error: "Arguments to path.resolve must be strings".
since gulp-browserify module is blacklisted I`ve tried to rewrite my old code in gulpfile.js without gulp-browserify.
I have this worked task with gulp-browserify
var gulp = require('gulp'),
browserify = require('gulp-browserify');
gulp.task('browserify', function() {
return gulp.src('./lib/tssoft.mons.js')
.pipe(browserify({
ignore: ['jsdom']
}))
.pipe(gulp.dest('./dist/'))
});
as you see I tell gulp-browserify to ignore require('jsdom') in browserifying.
After gulp-browserify was uninstalled I instal browserify module and rewrite code
var gulp = require('gulp'),
browserify = require('browserify');
gulp.task('browserify', function() {
var b = browserify();
b.ignore('jsdom');
b.add('./lib/tssoft.mons.js');
return b.bundle()
.pipe(gulp.dest('./dist/'));
});
And get this error: "Arguments to path.resolve must be strings".
Share Improve this question asked Apr 10, 2015 at 13:05 k.makarovk.makarov 8541 gold badge12 silver badges30 bronze badges2 Answers
Reset to default 8Stumpled upon this just a couple days ago, here you go:
var gulp = require('gulp'),
browserify = require('browserify'),
source = require('vinyl-source-stream');
gulp.task('browserify', function() {
var b = browserify();
b.ignore('jsdom');
var path = './lib/tssoft.mons.js';
b.add(path);
return b.bundle()
.pipe(source(path))
.pipe(gulp.dest('./dist/'));
});
The gulp-browerify ignore need a absolute path。 So you just :
var gulp = require('gulp'),
browserify = require('gulp-browserify');
gulp.task('browserify', function() {
return gulp.src('./lib/tssoft.mons.js')
.pipe(browserify({
ignore: [require.resolve('jsdom')]
}))
.pipe(gulp.dest('./dist/'))
});
Good luck