javascriptnode.jsgulpgulp-load-plugins

Gulp load plugins error dep is not defiend


I try to use gulp-load-plugins but I got error .

for example I try the following

var istanbul = require('gulp-istanbul');
var $ = require('gulp-load-plugins')({lazy: true});


    gulp.task('run', function () {
        return gulp.src(config.files)
            .pipe($.istanbul(
                {
                    instrumenter: isparta.Instrumenter
                }
            ))
            .pipe(istanbul.hookRequire());
    });

 when I remove the var istanbul = require('gulp-istanbul'); I got error ReferenceError: istanbul is not defined

   "devDependencies": {
    "chai": "3.5.0",
    "gulp": "^3.9.1",
    "gulp-copy": "0.0.2",
    "gulp-exec": "^2.1.2",
    "gulp-istanbul": "^1.0.0",
    "gulp-load-plugins": "^1.2.4",
    "gulp-util": "^3.0.7",
    "istanbul": "0.4.4",
    "mocha": "2.2.5",
    ...
}

Any idea what am I missing here?


Solution

  • You need to use $.istanbul

    .pipe($.istanbul.hookRequire())