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

Use babel npm package to transpile your ES6 to a commonjs target #25

Closed
abhijithvijayan opened this issue Oct 16, 2019 · 6 comments
Closed
Labels
help wanted Issue with a clear description that the community can help with.

Comments

@abhijithvijayan
Copy link
Owner

export const validate = _options => {
^^^^^^

SyntaxError: Unexpected token export

@abhijithvijayan
Copy link
Owner Author

See #19 (comment)

@abhijithvijayan
Copy link
Owner Author

The error occurs on running
`node cli.js -u "abhijithvijayan"

The module.exports doesn't seem to cooporate with importing in tests/index.test.js

@abhijithvijayan abhijithvijayan added hacktoberfest help wanted Issue with a clear description that the community can help with. labels Oct 16, 2019
@abhijithvijayan
Copy link
Owner Author

abhijithvijayan commented Oct 16, 2019

Possible fix:

In index.js

// default import
module.exports = bar;
module.exports.foo = foo;

Then import in another file

import fooBar from './';

fooBar();
fooBar.foo();

@JacobMGEvans
Copy link
Contributor

You could probably just implement babel-node and use newer JavaScript features, though Node should be supporting these by now what version of Node is this running on?

@abhijithvijayan
Copy link
Owner Author

@JacobMGEvans v10 LTS

Though it seems to be using babel-node a better idea, CLI works good for now, hence, unless required, we could stay using the Node.js features.

If you run into somekinda error writing tests or if yoi feel like using some advanced features, feel free to submit a PR with babel-node addition.

@JacobMGEvans
Copy link
Contributor

JacobMGEvans commented Oct 17, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with.
Projects
None yet
Development

No branches or pull requests

2 participants