Hello Everybody,
I’m moving a package to npm, but I want to use ES6.
I thought meteor would transpile it for me using the ecmascript
package.
But it seems like we have to do it manually.
Am I right?
3 Likes
No, Meteor won’t. For more info see:
opened 09:40PM - 28 Jul 15 UTC
closed 09:08PM - 15 Feb 17 UTC
Project:JS Environment
Hey Meteor team!
Got a quick question for ya, but first here's some context.
I'… m using meteor devel and have added the ecmascript plugin, I'm also using the meteorhacks:npm package to pull in a npm repo.
Is it possible to hook the ecmascript plugin into the Npm.require function so that it compiles the file before meteor attempts to wrap it in a function and run it?
Here's what's happening when I add a package that has files which are es6:
```
W20150728-12:34:14.710(-7)? (STDERR) <...>/.meteor/local/isopacks/npm-container/npm/node_modules/react-mixin-decorator/index.jsx:1
W20150728-12:34:14.710(-7)? (STDERR) (function (exports, require, module, __filename, __dirname) { import React fro
```
Seems like the issue is that you can't import or export when you are inside a function (and you are because we call node's NativeModule.wrap on the source then try to process.binding('evals').NodeScript.runInThisContext() which all seems to happens in local/build/main.js in my project.)
Really not sure how to hook in to Meteor's new compiler logic.
opened 05:29AM - 19 May 16 UTC
closed 12:38PM - 21 May 16 UTC
Type:Bug
### Problem
- `npm i --save async-es`
- client file with `import { parallel } fr… om 'async-es'`
- load client
results in this error:
`Uncaught SyntaxError: Unexpected token import`
![image](https://cloud.githubusercontent.com/assets/251288/15383411/d8862408-1d60-11e6-9548-935da3e593d0.png)
### Solution?
- Server: switch Meteor to a version of node that supports `import`
- Client: either have the npm package deal with this, or have the meteor build tool transpile