Pkg: Spread operator is not suported

Created on 15 Feb 2018  路  6Comments  路  Source: vercel/pkg

Hi,
in my code i have this
module.exports = {...defaultConfig, ...environment};

when I try to compile I get the following message

Unexpected token

Most helpful comment

I don't see why we should use babel/webpack to transpile code which doesn't need to be transpiled. In my backend only projects I carefully avoid to use unsupported syntax just not to install other dependencies as webpack/babel etc. This should be considered a pkg issue, since it should do any supposition about how a user organize his project.

All 6 comments

Yeah, am having the same issue too. I suspected it could be the node issue. But it looks like pkg issue. @igorklopov any idea why?

Not sure if this is a pkg issue per se. How are you transpiling ES6 -> ES5? Node supports some ES6 syntax, but not all, so which version of node are you using?

Personally, I use webpack to babelfy the code prior to using pkg to avoid these sort of things. I am able to use all ES6 standards with node and pkg this way as I utilize object spread liberally.

Don't think this is a pkg issue per se. How are you transpiling ES6 -> ES5? Node supports some ES6 syntax, but not all, so which version of node are you using?

Using the latest LST version v8.9.4.

Node v8.9.4 supports use of spread operator without need of transpiling the code. Not sure why pkg would not?

Not sure, maybe something in how the binaries are packaged... again, I use webpack/babel to compress/transpile my code and then run pkg.

Duplicate of #206

I don't see why we should use babel/webpack to transpile code which doesn't need to be transpiled. In my backend only projects I carefully avoid to use unsupported syntax just not to install other dependencies as webpack/babel etc. This should be considered a pkg issue, since it should do any supposition about how a user organize his project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Admiral-Enigma picture Admiral-Enigma  路  3Comments

Nisthar picture Nisthar  路  4Comments

ksmithut picture ksmithut  路  4Comments

peterjwest picture peterjwest  路  3Comments

jflayhart picture jflayhart  路  4Comments