Arrow function from meteor build is crashing heroku deploy

天大地大妈咪最大 提交于 2019-12-24 01:27:16

问题


I have deployed a js application on heroku that uses meteor. The build works on localhost but fails on the heroku server. I checked the logs and found this:

.js:312:12)
2017-03-18T03:29:07.070711+00:00 app[web.1]: const unicodeNormalizePath     = (path) => {
2017-03-18T03:29:07.074825+00:00 app[web.1]:     at Module.require (module.js:364:17)
2017-03-18T03:29:07.074821+00:00 app[web.1]: SyntaxError: Unexpected token >
2017-03-18T03:29:07.074824+00:00 app[web.1]:     at Module.load (module.js:356:32)
2017-03-18T03:29:07.070741+00:00 app[web.1]:                                          ^

This gave me the thought that it was not compatible with ES6 arrow functions so I installed ecmascript for meteor to make it compatible with ES5.

This has not solved the problem and this arrow function is still crashing the web app.

Any suggestions on how to stop this?


回答1:


I had the same problem using, probably, an old buildpack for Heroku. I switched to the buildpack https://github.com/AdmitHub/meteor-buildpack-horse.git and it solved the problem perfectly.

Working buildpack:

heroku buildpacks:set https://github.com/AdmitHub/meteor-buildpack-horse.git

I also disabled the previous buildpack by typing:

heroku config:unset LINK_TO_OLD_BUILDPACK_REPO

The old one I used was https://github.com/jordansissel/heroku-buildpack-meteor.git




回答2:


May be you can use babel to transform es6 to es5



来源:https://stackoverflow.com/questions/42870295/arrow-function-from-meteor-build-is-crashing-heroku-deploy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!