如何使用 `type: module` 在 NodeJS 14 中动态导入 firebase 云函数配置? [关闭]
How import firebase cloud function config dynamically in NodeJS 14 with `type: module`? [ closed ]
我想实现动态导入云功能配置,但它不会按预期工作。
import config from "firebase-functions";
有效 ✔️
const {config} = await import('firebase-functions');
不行 ❌
也尝试了以下但不起作用。
import * as functions from "firebase-functions"; // function is already using as static import
or
const functions = await import('firebase-functions');
functions.config ❌// => undefined
functions.auth ✔️
functions.firestore ✔️
//and analytics, app, auth, database, firestore, handler, https, pubsub, remoteConfig, storage, testLab, logger ✔️
无法动态导入配置导入和函数。
哦,终于成功了。
const { default: functions} = await import('firebase-functions');
和
import functions from "firebase-functions";
给予functions.config
我想实现动态导入云功能配置,但它不会按预期工作。
import config from "firebase-functions";
有效 ✔️
const {config} = await import('firebase-functions');
不行 ❌
也尝试了以下但不起作用。
import * as functions from "firebase-functions"; // function is already using as static import
or
const functions = await import('firebase-functions');
functions.config ❌// => undefined
functions.auth ✔️
functions.firestore ✔️
//and analytics, app, auth, database, firestore, handler, https, pubsub, remoteConfig, storage, testLab, logger ✔️
无法动态导入配置导入和函数。
哦,终于成功了。
const { default: functions} = await import('firebase-functions');
和
import functions from "firebase-functions";
给予functions.config