meteorhacks / npm

Complete NPM integration for Meteor
http://meteorhacks.com/complete-npm-integration-for-meteor.html
MIT License
508 stars 43 forks source link

Syntax error with template string in npm module #120

Open godjirax opened 8 years ago

godjirax commented 8 years ago

I have problem with npm producthunt module that i try to add in my meteor project with meteorhacks.

I can reproduce the problem with the example :

meteor create simple-todos
meteor add meteorhacks:npm
cd simple-todos

I create the file packages.json at the root of the project, with :

{
    "producthunt":"0.2.0"
}

If i launch project with any modification, it works.

If i import the npm module in simple-todos.js (Meteor.npmRequire('producthunt')), i obtain the error:

W20160115-09:16:08.729(1)? (STDERR) simple-todos/.meteor/local/isopacks/npm-container/npm/node_modules/producthunt/index.js:25
W20160115-09:16:08.729(1)? (STDERR)   this.posts = require(`./api/v${this.version}/posts`)(this)

The error occurs with the use of template string.

But, if a try to use it in simple-todos.js, it works well :

var obj = {
    prop : 'test'
  };
console.log(`./api/${obj.prop}/posts`);

  // --> ./api/test/posts

It seems that the project can execute ecmascript6 script, but not npm imported module.

j-holub commented 8 years ago

I can confirm that bug. I wrote a npm module which I actually wanted to use with meteor. But template Strings break it.

Node itself can run it, and if I use template Strings in meteor directly they work fine as well. But importing an npm module with template string breaks the compatibility.