browserify-ngannotate icon indicating copy to clipboard operation
browserify-ngannotate copied to clipboard

Crashing with gulp and browserify on reload

Open OnkelTem opened this issue 10 years ago • 3 comments

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?

OnkelTem avatar Oct 01 '15 22:10 OnkelTem

+1

evanjmg avatar Oct 28 '16 13:10 evanjmg

+1

lharti avatar Dec 06 '16 14:12 lharti

Running into the same issue here.

asteffes avatar May 07 '19 14:05 asteffes