2

我正在使用 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'));
});

有没有办法让 watchify 与 Webstorm 一起工作?谢谢你的帮助。

4

1 回答 1

4

我发布这个只是为了未来的搜索者 - 我认为这个问题的原因是Enabled "Use safe write"。禁用后问题似乎消失了。

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

于 2015-10-29T09:21:05.513 回答