Firebase webpack+babel functions not deploying

喜夏-厌秋 提交于 2020-01-05 06:46:52

问题


Is it possible to make firebase functions work with webpack and babel?

We need to reuse existing ES6 classes on server side which we can't edit so we need to transpile them to make it work in node.

Spent two days on the related tutorials but I'm hitting the problem where firebase can't seem to see functions declared in index.js after they were wrapped by webpack in a function.

here is a part of the resulting index.js:

(function(module, exports, __webpack_require__) {

    var functions = __webpack_require__(/*! firebase-functions */ "firebase-functions");
    var admin = __webpack_require__(/*! firebase-admin */ "firebase-admin");
    admin.initializeApp();

    exports.api = functions.https.onRequest(function (req, res) {
      res.send({
        msg: "ok"
      });
    });

})

exports.api = functions.https.onRequest is not deploying in this case.

Is it ever possible to make firebase work with webpack and babel?

来源:https://stackoverflow.com/questions/59118080/firebase-webpackbabel-functions-not-deploying

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