0

我尝试使用 gulp-load-plugins 但出现错误。

例如我尝试以下

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());
    });

 当我删除 var istanbul = require('gulp-istanbul'); 我收到错误 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",
    ...
}

知道我在这里想念什么吗?

4

1 回答 1

0

你需要使用$.istanbul

.pipe($.istanbul.hookRequire())
于 2016-07-26T07:15:56.030 回答