Webtorrent: Error on dependency parsing by JSPM

Created on 24 Aug 2018  路  7Comments  路  Source: webtorrent/webtorrent

0.102.1

Ubuntu 16.04

Chrome, Chromium, Firefox -> latest

What did you expect to happen?
sfx bundle

What actually happened?
Error on dependency parsing for github:webtorrent/[email protected]/webtorrent.min.js at file:///.../jspm_packages/github/webtorrent/[email protected]/webtorrent.min.js
=> MultipleErrors: :1:98229: 'this' is not allowed before super()

bug

Most helpful comment

@KayleePop Nope :)

Fix published as 0.102.2 :)

All 7 comments

There must be a module extending but not calling super() that was refactored to ES6

Here's what threw the error from the minified build using that line:column from the trace (beautified)

class o extends r.Writable {
  constructor(e, t, r) {
    function o(t) {
      this.destroyed || (e.put(i, t), i += 1)
    }

    if (super(r), r || (r = {}), !e || !e.put || !e.get) {
      throw new Error("First argument must be an abstract-chunk-store compliant store");
    }

    if (t = +t, !t) throw new Error("Second argument must be a chunk length");

    this._blockstream = new n(t, {
      zeroPadding: !1
    }), this._blockstream.on("data", o).on("error", e => {
      this.destroy(e)
    });

    let i = 0;

    this.on("finish", function() {
      this._blockstream.end()
    })
  }

This is clearly from here https://github.com/feross/chunk-store-stream/blob/v3.0.0/write.js

I think the function onData() (here) is getting pushed up above super(opts) by the minifier.

Published the fix in chunk-store-stream 3.0.1

@feross missed the other PR with a minor change :p

Is this a bug in the minifier? Should we open an issue?

@KayleePop Nope :)

Fix published as 0.102.2 :)

Thanks for the quick fix!!!

Was this page helpful?
0 / 5 - 0 ratings