Sunday, 28 May 2017

undefined variable in browserify's bundle

I'm working on a project and I use angularjs with cordova. I have one module that should work on the server side (docx) that I put in a bundle with browserify.

Everything seems fine but I get an error from the bundle generated by browserify :

TypeError: fs$ReadStream is undefined line 14056

I checked the code and the variable legstream is undefined so I think the error comes from the legacy(fs) but I don't know why.

  if (process.version.substr(0, 4) === 'v0.8') {
    var legStreams = legacy(fs)
    ReadStream = legStreams.ReadStream
    WriteStream = legStreams.WriteStream
  }

 var fs$ReadStream = fs.ReadStream
 console.log(legStreams);
 ReadStream.prototype = Object.create(fs$ReadStream.prototype)
 ReadStream.prototype.open = ReadStream$open

If someone already had something like this, please help me, it's kind of urgent. Thanks :)



via Quentin

No comments:

Post a Comment