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

Do something about ES6 exporting #803

Open
dbkr opened this issue Dec 10, 2018 · 8 comments
Open

Do something about ES6 exporting #803

dbkr opened this issue Dec 10, 2018 · 8 comments

Comments

@dbkr
Copy link
Member

dbkr commented Dec 10, 2018

Recently we're starting to want to pull in libraries that export, or have dependencies that export, ES6. As far as I can tell, there are no guidelines or structure whatsoever in NPM / the JS ecosystem on what language NPM modules are exported as, and now that any vaguely recent node version and all modern browsers support ES6, the answer increasingly seems to be ES6 rather than ES5.

Our options are:

  • Continue to export ES5 by babeling everything, dependencies and all (slow)
  • Continue to export ES5 by babeling only specific dependencies (major faff to keep the list of babel-ed depds up to date)
  • Switch to exporting ES6
@jryans
Copy link
Collaborator

jryans commented Dec 10, 2018

I would suggest switching to exporting ES6, which is well supported in recent browser and node versions.

@bwindels
Copy link
Contributor

bwindels commented Dec 10, 2018

(partial) list of projects that depend on js-sdk, whose build we could potentially break: https://www.npmjs.com/package/matrix-js-sdk?activeTab=dependents
Thinking if it would be ok to switch to exporting ES6 if we'd release it as a major version change (0.x)...?

@turt2live
Copy link
Member

+1 to ES6 and bumping the version

@dbkr
Copy link
Member Author

dbkr commented Dec 10, 2018

Seems reasonable: the implication of this, of course, is that we stop babel-ing our source files (unless we need to babel down to ES6) since if we are exporting ES6 we might as well export everything in ES6.

dbkr added a commit that referenced this issue Jan 7, 2019
This is a somewhat experimental PR to make the build process target
ES6 rather than ES5 given ES6 is now widely supported.

#803
@jkasun
Copy link
Contributor

jkasun commented May 21, 2019

Can I hop in to this?

@jryans
Copy link
Collaborator

jryans commented May 21, 2019

@dbkr has made an attempt a while back in #817. Perhaps building on that and fixing the remaining issues would be a way forward here.

@stalniy
Copy link
Contributor

stalniy commented May 29, 2019

I’d suggest to use rollup with its plugins. Also it’ll allow to bundle browser version inside npm package.

Currently we need to download it from github releases which is really inconvenient.

Another benefit from ES6 version is that during development of client web app, unused functionality will be shakes out

@jryans
Copy link
Collaborator

jryans commented May 30, 2019

#931 has added a tiny amount of ES 6 (via the dependency base-x) which will be released as 2.0.0 because of the breaking change for syntax.

This issue remains though, because we haven't yet started exporting ES 6 for the SDK's own code. When we do so, it will no longer be a breaking change, so most likely a MINOR version will be appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants