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

SyntaxError: Unexpected reserved word when exporting a class in Node v4.0.0 #2954

Closed
JVerstry opened this issue Sep 18, 2015 · 5 comments
Closed

Comments

@JVerstry
Copy link

I have started using Node 4 and implemented a simple class:

"use strict";

class AspectType {

    // ....    

};

export default AspectType;

But I get an error message:

SyntaxError: Unexpected reserved word

I have followed recommendations made in a StackOverflow question: http://stackoverflow.com/questions/32657516/how-to-export-a-es6-class-properly-in-node-4

It looks like a bug to me, or what am I doing wrong? My node version is: v4.0.0.

@evanlucas
Copy link
Contributor

Yes, you would need to use module.exports = AspectType for now as ES6 modules are not currently implemented

@evanlucas
Copy link
Contributor

Going to go ahead and close as this isn't directly actionable.

@guisouza
Copy link
Contributor

=[ whyyy ??

@Kamin12
Copy link

Kamin12 commented Jan 8, 2016

where would one use module.exports? I've done a project search and that line comes up around 200 times...

@MylesBorins
Copy link
Contributor

@Kamin12

The object module.exports is what will be returned when someone requires your project.

A short hand for the object is simply exports

The object is created by mode for every file, but you can overwrite it.

Many people do exports.someFunction to export individual functions.

Whatever object module.exports is referring to is what will be returned

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

No branches or pull requests

5 participants