From 0791bc62f76674000293047a51ca57ea1eb7cefd Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Fri, 7 Oct 2022 13:07:45 -0700 Subject: [PATCH 1/2] Remove json path and fix process check --- packages/util/src/defaults.ts | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/util/src/defaults.ts b/packages/util/src/defaults.ts index 6acc5886b5c..185269dc3d4 100644 --- a/packages/util/src/defaults.ts +++ b/packages/util/src/defaults.ts @@ -57,33 +57,13 @@ const getDefaultsFromGlobal = (): FirebaseDefaults | undefined => * process.env.__FIREBASE_DEFAULTS_PATH__ */ const getDefaultsFromEnvVariable = (): FirebaseDefaults | undefined => { - if (typeof process === 'undefined') { + if (typeof process === 'undefined' || typeof process.env === 'undefined') { return; } const defaultsJsonString = process.env.__FIREBASE_DEFAULTS__; - const defaultsJsonPath = process.env.__FIREBASE_DEFAULTS_PATH__; if (defaultsJsonString) { - if (defaultsJsonPath) { - console.warn( - `Values were provided for both __FIREBASE_DEFAULTS__ ` + - `and __FIREBASE_DEFAULTS_PATH__. __FIREBASE_DEFAULTS_PATH__ ` + - `will be ignored.` - ); - } return JSON.parse(defaultsJsonString); } - if (defaultsJsonPath && typeof require !== 'undefined') { - try { - // eslint-disable-next-line @typescript-eslint/no-require-imports - const json = require(defaultsJsonPath); - return json; - } catch (e) { - console.warn( - `Unable to read defaults from file provided to ` + - `__FIREBASE_DEFAULTS_PATH__: ${defaultsJsonPath}` - ); - } - } }; const getDefaultsFromCookie = (): FirebaseDefaults | undefined => { From 9b9875c97f4cf3317b4c2e65e0bdd223017f3a46 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Fri, 7 Oct 2022 13:16:57 -0700 Subject: [PATCH 2/2] Add changeset --- .changeset/strong-squids-dress.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/strong-squids-dress.md diff --git a/.changeset/strong-squids-dress.md b/.changeset/strong-squids-dress.md new file mode 100644 index 00000000000..dc68a002421 --- /dev/null +++ b/.changeset/strong-squids-dress.md @@ -0,0 +1,5 @@ +--- +'@firebase/util': patch +--- + +Remove `__FIREBASE_DEFAULTS_PATH__` option for now, as the current implementation causes Webpack warnings. Also fix `process.env` check to work in environments where `process` exists but `process.env` does not.