ES6 inside packages?

Has anyone gotten ES6 syntax to work inside meteor packages?

1 Like

In your package.js file, did you try?

api.use('jsx');

and then make sure your file has .jsx for its extension.

Yes. Just add api.use('grigio:babel@0.1.6'). See https://github.com/meteor-velocity/velocity-helpers.

I use the official JSX package, but I was unable to get it to recognize the ES6 syntax

Looks like the ES6 modules are not implemented yet and won’t be until after the next Meteor release.

So, if you’re trying to use modules, that’s probably what’s going on. If you need or want module support, keep on eye on: https://atmospherejs.com/rocket/module

Otherwise, here’s some documentation for the jsx package: http://react-in-meteor.readthedocs.org/en/latest/jsx/ including a list of the enabled transforms.

If this doesn’t answer your question, more information on your issue is always useful in order to help best. For example, post what you already tried, code snippets, a repository link, etc.