pimterry / server-components

:wrench: A simple, lightweight tool for composable HTML rendering in Node.js, based on web components.
https://pimterry.github.io/server-components
MIT License
216 stars 12 forks source link

Example with ES6 imports #25

Closed prateekjadhwani closed 8 years ago

prateekjadhwani commented 8 years ago

I was wondering if there is a way to create a component in ES6 syntax and import it into another components. Would it be possible for you to modify the attached examples in the README file?

pimterry commented 8 years ago

What do you mean by 'ES6' syntax? Some options:

pimterry commented 8 years ago

Ah, you've actually specified in it the title - imports/exports.

No: server components doesn't have built-in support for that, so you'll need external support, and Node doesn't do that yet. I think the latest details on Node's plan for this are at https://github.com/nodejs/node-eps/blob/master/002-es6-modules.md, and the tracking issue is https://github.com/nodejs/help/issues/53. Alternatively, you can use Babel for this in the meantime.

If I were you though, I wouldn't worry about it for now - you don't gain much vs CommonJS, and support doesn't really exist for them anywhere yet.