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

Convert to ES Module format #76

Open
creationix opened this issue Aug 17, 2017 · 7 comments
Open

Convert to ES Module format #76

creationix opened this issue Aug 17, 2017 · 7 comments

Comments

@creationix
Copy link

What do you think about porting the source to ES6 module format? It would be pretty easy to still publish to npm or other places as CJS in a build step. You could even include the ES6 code in the npm package for consumers who prefer that.

My personal desire is to make it easier to consume using rollup and only include functions my code uses.

@daurnimator
Copy link
Member

daurnimator commented Aug 18, 2017

How do you support conditional imports with es6 modules?

My personal desire is to make it easier to consume using rollup and only include functions my code uses.

Hrm, this sounds interesting: what are you planning? :)

@creationix
Copy link
Author

No concrete plans. Just trying to get some interesting libraries in a more easily consumable format. Tooling for ES6 modules is a lot easier than CJS modules.

@daurnimator
Copy link
Member

I don't think we'll do this until node adds support for the import statement.

@daurnimator
Copy link
Member

I had a look at this today using rollup.
It seemed like an improvement, but the tooling doesn't seem to be there 100% yet.

e.g. I'm not sure how to have a DefinePlugin-like thing that causes different imports for node vs browser.

@daurnimator
Copy link
Member

daurnimator commented Feb 5, 2018

Webpack 4.0 is getting proper ES6 support; so that might make this finally possible.
Relevant announcement: https://medium.com/webpack/webpack-4-beta-try-it-today-6b1d27d7d7e2

@s-ol
Copy link

s-ol commented May 4, 2018

not sure if it fits here - but will this allow letting babel transpile this module into ES5 too?
Right now fengari runs everywhere except on old iOs devices, where const etc. aren't supported yet.

@daurnimator
Copy link
Member

not sure if it fits here - but will this allow letting babel transpile this module into ES5 too?

fengari can already be transpiled. Infact fengari-web is distributed in ES5 form.

Right now fengari runs everywhere except on old iOs devices, where const etc. aren't supported yet.

How old? lack of const shouldn't be the issue there. Safari 7 is missing weak maps and a couple of other things which is why fengari doesn't work before iOS 8.3; which rules out working on an iPhone 4, as the highest they support is iOS 7.1

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

3 participants