Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on dependency parsing by JSPM #1481

Closed
Weedshaker opened this issue Aug 24, 2018 · 7 comments
Closed

Error on dependency parsing by JSPM #1481

Weedshaker opened this issue Aug 24, 2018 · 7 comments
Labels
bug

Comments

@Weedshaker
Copy link

@Weedshaker Weedshaker commented Aug 24, 2018

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/webtorrent@0.102.1/webtorrent.min.js at file:///.../jspm_packages/github/webtorrent/webtorrent@0.102.1/webtorrent.min.js
=> MultipleErrors: :1:98229: 'this' is not allowed before super()

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 26, 2018

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

@DiegoRBaquero DiegoRBaquero added the bug label Aug 26, 2018
@KayleePop

This comment has been minimized.

Copy link
Contributor

@KayleePop KayleePop commented Aug 26, 2018

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.

DiegoRBaquero added a commit to DiegoRBaquero/chunk-store-stream that referenced this issue Aug 26, 2018
ES6 fix
Function hoisting is breaking WebTorrent build, see webtorrent/webtorrent#1481.
@DiegoRBaquero DiegoRBaquero mentioned this issue Aug 26, 2018
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Aug 27, 2018

Published the fix in chunk-store-stream 3.0.1

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 27, 2018

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

@KayleePop

This comment has been minimized.

Copy link
Contributor

@KayleePop KayleePop commented Aug 27, 2018

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

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 27, 2018

@KayleePop Nope :)

Fix published as 0.102.2 :)

@Weedshaker

This comment has been minimized.

Copy link
Author

@Weedshaker Weedshaker commented Aug 28, 2018

Thanks for the quick fix!!!

@lock lock bot locked as resolved and limited conversation to collaborators Nov 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.