omsmith / browserify-ngannotate

57 stars 7 forks source link

Crashing with gulp and browserify on reload #22

Open OnkelTem opened 9 years ago

OnkelTem commented 9 years ago

I have a task like this:

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

gulp.task('browserify', function(callback) {
...
    var bundler = browserify({
      cache: {}, packageCache: {}, fullPaths: true,
      entries: bundleConfig.entries,
      extensions: config.extensions,
      debug: bundleConfig.debug
    });
    var bundle = function() {
      bundler.transform('browserify-ngannotate');
      return bundler
        .bundle()
        .pipe(source(bundleConfig.outputName))
        .pipe(gulp.dest(bundleConfig.dest))
        .on('end', reportFinished);
    };
    if(global.isWatching) {
      bundler = watchify(bundler);
      bundler.on('update', bundle);
    }
...
});

which works only once until reload. After I edit a js file the bundling fails with this error:

/var/www/sites/sodr/node_modules/ng-annotate/node_modules/source-map/lib/source-map/source-map-generator.js:175
          throw new Error(
                ^
Error: SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.
    at SourceMapGenerator_applySourceMap [as applySourceMap] (/var/www/sites/sodr/node_modules/ng-annotate/node_modules/source-map/lib/source-map/source-map-generator.js:175:17)
    at SourceMapper.applySourceMap (/var/www/sites/sodr/node_modules/ng-annotate/build/es5/generate-sourcemap.js:92:20)
    at generateSourcemap (/var/www/sites/sodr/node_modules/ng-annotate/build/es5/generate-sourcemap.js:115:20)
    at ngAnnotate (/var/www/sites/sodr/node_modules/ng-annotate/build/es5/ng-annotate-main.js:1153:9)
    at DestroyableTransform.flush [as _flush] (/var/www/sites/sodr/node_modules/browserify-ngannotate/index.js:45:24)
    at DestroyableTransform.<anonymous> (/var/www/sites/sodr/node_modules/browserify-ngannotate/node_modules/readable-stream/lib/_stream_transform.js:135:12)
    at DestroyableTransform.g (events.js:199:16)
    at DestroyableTransform.emit (events.js:129:20)
    at finishMaybe (/var/www/sites/sodr/node_modules/browserify-ngannotate/node_modules/readable-stream/lib/_stream_writable.js:371:12)
    at endWritable (/var/www/sites/sodr/node_modules/browserify-ngannotate/node_modules/readable-stream/lib/_stream_writable.js:378:3)

Any ideas?

evanjmg commented 7 years ago

+1

lharti commented 7 years ago

+1

asteffes commented 5 years ago

Running into the same issue here.