Skip to content

Commit 29d0340

Browse files
authored
Remove json path and fix process check (#6665)
1 parent 0a112bd commit 29d0340

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

.changeset/strong-squids-dress.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/util': patch
3+
---
4+
5+
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.

packages/util/src/defaults.ts

+1-21
Original file line numberDiff line numberDiff line change
@@ -57,33 +57,13 @@ const getDefaultsFromGlobal = (): FirebaseDefaults | undefined =>
5757
* process.env.__FIREBASE_DEFAULTS_PATH__
5858
*/
5959
const getDefaultsFromEnvVariable = (): FirebaseDefaults | undefined => {
60-
if (typeof process === 'undefined') {
60+
if (typeof process === 'undefined' || typeof process.env === 'undefined') {
6161
return;
6262
}
6363
const defaultsJsonString = process.env.__FIREBASE_DEFAULTS__;
64-
const defaultsJsonPath = process.env.__FIREBASE_DEFAULTS_PATH__;
6564
if (defaultsJsonString) {
66-
if (defaultsJsonPath) {
67-
console.warn(
68-
`Values were provided for both __FIREBASE_DEFAULTS__ ` +
69-
`and __FIREBASE_DEFAULTS_PATH__. __FIREBASE_DEFAULTS_PATH__ ` +
70-
`will be ignored.`
71-
);
72-
}
7365
return JSON.parse(defaultsJsonString);
7466
}
75-
if (defaultsJsonPath && typeof require !== 'undefined') {
76-
try {
77-
// eslint-disable-next-line @typescript-eslint/no-require-imports
78-
const json = require(defaultsJsonPath);
79-
return json;
80-
} catch (e) {
81-
console.warn(
82-
`Unable to read defaults from file provided to ` +
83-
`__FIREBASE_DEFAULTS_PATH__: ${defaultsJsonPath}`
84-
);
85-
}
86-
}
8767
};
8868

8969
const getDefaultsFromCookie = (): FirebaseDefaults | undefined => {

0 commit comments

Comments
 (0)