使用Webstorm时,Watchify不会更新

时间:2015-05-01 11:32:39

标签: gulp webstorm browserify watchify

我正在使用watchify和gulp。使用notepad ++编辑源代码时,watchify工作正常,但是当我使用Jetbrain Webstorm 8进行编辑时它没有任何作用。 这是我的gulpfile:

var browserify = require('browserify');
var watchify = require('watchify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');

gulp.task('watchify', function(){
    var bundler = browserify('./app/js/app.js', {
        debug: true,
        cache: {}, 
        packageCache: {}
        fullPaths: true
    });
    var watcher  = watchify(bundler);

    return watcher.on('update', function () { // When any files update
            console.log('Updating!');
            var updateStart = Date.now();
            watcher.bundle()
                .pipe(source('bundle.js'))
                .pipe(gulp.dest('./app/js'));
            console.log('Updated!', (Date.now() - updateStart) + 'ms');
        })
        .bundle() // Create the initial bundle when starting the task
        .pipe(source('bundle.js'))
        .pipe(gulp.dest('./app/js'));
});

无论如何都要使用Webstorm进行观察工作? 谢谢你的帮助。

1 个答案:

答案 0 :(得分:4)

我发布此信息仅仅是为了未来的搜索者 - 我认为该问题的原因是已启用"使用安全写入" 。禁用后问题似乎消失了。

https://github.com/substack/watchify/issues/179