Gulp load plugins error dep is not defiend

不羁的心 提交于 2019-12-25 09:05:29

问题


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?


回答1:


You need to use $.istanbul

.pipe($.istanbul.hookRequire())


来源:https://stackoverflow.com/questions/38583304/gulp-load-plugins-error-dep-is-not-defiend

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!