Firebase 功能部署不更新

Firebase functions deployment not updating

我在多个文件中设置了我的 firebase 函数。出于某种原因,当我部署时,更改没有被应用,就好像它们被缓存了一样。

我的文件夹结构如下:

函数/

scr/

index.ts
auth.ts
inventory.ts

这是我的 index.ts:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const functions = require("firebase-functions");
const admin = require("firebase-admin");
exports.auth = require("./auth");
exports.inventory = require("./inventory");
admin.initializeApp();

auth.ts:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const auth_functions = require("firebase-functions");
exports.login = auth_functions.https.onRequest(
  (request: any, response: any) => {
    response.send("login");
  }
);

exports.logout = auth_functions.https.onRequest(
  (request: any, response: any) => {
    response.send("logout");
  }
);

inventory.ts

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const inventory_functions = require("firebase-functions");
exports.getByLocation = inventory_functions.https.onRequest(
  async (request: any, response: any) => {
  response.send("inventory");
});

我之后运行

firebase deploy --only functions

一切都显示成功,但我没有看到模拟器或部署时的变化。我还尝试了 renaming/removing 一个函数,但 cli 忽略了它,只显示成功。考虑到日志什么也没告诉我,也没有发生错误,这非常令人沮丧。

问题出在我的 package.json 中,index.js 的路径错误。基本上是构建到一个与我从中部署的目录不同的目录。只需要更新到

"main": "lib/index.js",