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

Meta: ES Next #1443

Open
feross opened this issue Jul 27, 2018 · 13 comments
Open

Meta: ES Next #1443

feross opened this issue Jul 27, 2018 · 13 comments
Labels

Comments

@feross
Copy link
Member

@feross feross commented Jul 27, 2018

Let's convert all WebTorrent packages to ES6. (Continued from #444)

Note that this is a separate task from async-await (Promises) support.

  • webtorrent
  • bittorrent-dht
  • bittorrent-peerid
  • bittorrent-protocol
  • bittorrent-tracker
  • create-torrent
  • magnet-uri
  • parse-torrent
  • render-media
  • torrent-discovery
  • ut_metadata
  • ut_pex
  • webtorrent-fixtures
  • addr-to-ip-port
  • webtorrent-cli
  • webtorrent-hybrid
  • load-ip-set
  • ip-set
@feross feross changed the title ES Next ES Next Meta-Issue Jul 27, 2018
@feross feross mentioned this issue Jul 27, 2018
@feross feross changed the title ES Next Meta-Issue Meta: ES Next Jul 27, 2018
@hgghyxo

This comment has been minimized.

Copy link

@hgghyxo hgghyxo commented Aug 22, 2018

Do you plan to add support for ESModule like imports?

import { WebTorrent } from 'https://unpkg.com/webtorrent'

Uncaught SyntaxError: The requested module 'https://unpkg.com/webtorrent' does not provide an export named 'WebTorrent'

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 22, 2018

@hgghyxo I think you have to do import * as WebTorrent from ...

@hgghyxo

This comment has been minimized.

Copy link

@hgghyxo hgghyxo commented Aug 22, 2018

Have tried all the methods, but it always have some problems. In this case:

Uncaught ReferenceError: module is not defined
at index.js:3

which is module.exports = WebTorrent
but pretty sure it would have problems with require() as well

Tried the minified version as well:
import * as WebTorrent from 'https://unpkg.com/webtorrent@0.102.1/webtorrent.min.js'

Uncaught TypeError: WebTorrent is not a constructor
at main.js:3

@hgghyxo

This comment has been minimized.

Copy link

@hgghyxo hgghyxo commented Aug 22, 2018

my workaround here is to simply call a <script src="//unpkg.com/webtorrent@0.102.1/webtorrent.min.js"> tag from index.html

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 22, 2018

Are you using webpack, babel?

@hgghyxo

This comment has been minimized.

Copy link

@hgghyxo hgghyxo commented Aug 22, 2018

neither, ESModule:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
the <script type="module" src="..."> thingy

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 22, 2018

oh, then just use the normal import and it'll be available as a global.

There's no plan on supporting ES Modules atm

@hgghyxo

This comment has been minimized.

Copy link

@hgghyxo hgghyxo commented Aug 26, 2018

Webtorrent-hybrid was't a big project: webtorrent/webtorrent-hybrid#86
:)

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 30, 2018

webtorrent main lib done!

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Aug 31, 2018

Just a note to everyone!

You can use lebab with this command: lebab --replace <FILE> --transform arrow,let,includes,template,default-param,obj-shorthand,obj-method,arg-spread,arg-rest,for-each,class

@jimmywarting

This comment has been minimized.

Copy link
Contributor

@jimmywarting jimmywarting commented Oct 17, 2018

PR's waiting to be merged

  • webtorrent
  • bittorrent-dht
  • bittorrent-peerid
  • bittorrent-protocol
  • bittorrent-tracker
  • create-torrent
  • magnet-uri
  • parse-torrent
  • render-media #51
  • torrent-discovery
  • ut_metadata
  • ut_pex #23
  • webtorrent-fixtures
  • addr-to-ip-port
  • webtorrent-cli #82
  • webtorrent-hybrid #87
  • load-ip-set
  • ip-set
@jimmywarting

This comment has been minimized.

Copy link
Contributor

@jimmywarting jimmywarting commented Nov 27, 2018

Not sure if it was intended to close this

@DiegoRBaquero DiegoRBaquero reopened this Nov 28, 2018
@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Nov 28, 2018

Correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.