Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Example with ES6 imports #25

Closed
prateekjadhwani opened this issue Jul 23, 2016 · 2 comments
Closed

Example with ES6 imports #25

prateekjadhwani opened this issue Jul 23, 2016 · 2 comments

Comments

@prateekjadhwani
Copy link

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
Copy link
Owner

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

  • Using ES6 features like arrow functions. Yes, definitely - you can use whatever your version of node supports, and it will Just Work.
  • Using ES6 modules for import/export. No, not without a transpiler back to CommonJS, since (afaik) Node doesn't have any support for these yet.

@pimterry
Copy link
Owner

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 nodejs/help#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.

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

No branches or pull requests

2 participants