Skip to content

Commit dd318bf

Browse files
committed
Merge branch '@invertase/v7-development' of https://github.com/firebase/firebaseui-web into @invertase/v7-development
2 parents 22fbe6f + dea622d commit dd318bf

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

packages/core/src/index.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,29 @@
1515
* limitations under the License.
1616
*/
1717

18-
import { registerFramework } from "./register-framework";
1918
import pkgJson from "../package.json";
19+
import { registerFramework } from "./register-framework";
2020

2121
export * from "./auth";
2222
export * from "./behaviors";
2323
export * from "./config";
24+
export * from "./country-data";
2425
export * from "./errors";
26+
export * from "./register-framework";
2527
export * from "./schemas";
26-
export * from "./country-data";
2728
export * from "./translations";
28-
export * from "./register-framework";
2929

30-
if (import.meta.env.PROD) {
31-
registerFramework("core", pkgJson.version);
30+
// Detect production mode across different build systems (Vite, webpack/Next.js, etc.)
31+
const isDevelopment = typeof process !== "undefined" && process.env.NODE_ENV === "production";
32+
33+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
34+
const isViteProduction = (import.meta as any)?.env?.PROD === true;
35+
36+
// Check if in production mode
37+
const isProduction = isDevelopment || isViteProduction;
38+
39+
if (isProduction) {
40+
// Extract framework name from package name (e.g., "@invertase/firebaseui-react" -> "react")
41+
const frameworkName = pkgJson.name.replace("@invertase/firebaseui-", "");
42+
registerFramework(frameworkName, pkgJson.version);
3243
}

packages/react/src/index.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,23 @@
1818
import { registerFramework } from "@invertase/firebaseui-core";
1919
import pkgJson from "../package.json";
2020

21-
export { PolicyContext } from "./components/policies";
2221
export * from "./auth";
23-
export * from "./hooks";
2422
export * from "./components";
23+
export { PolicyContext } from "./components/policies";
2524
export { FirebaseUIProvider, type FirebaseUIProviderProps } from "./context";
25+
export * from "./hooks";
26+
27+
// Detect production mode across different build systems (Vite, webpack/Next.js, etc.)
28+
const isNodeProduction = typeof process !== "undefined" && process.env.NODE_ENV === "production";
29+
30+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
31+
const isViteProduction = (import.meta as any)?.env?.PROD === true;
32+
33+
// Check if in production mode
34+
const isProduction = isNodeProduction || isViteProduction;
2635

27-
if (import.meta.env.PROD) {
28-
registerFramework("react", pkgJson.version);
36+
if (isProduction) {
37+
// Extract framework name from package name (e.g., "@invertase/firebaseui-react" -> "react")
38+
const frameworkName = pkgJson.name.replace("@invertase/firebaseui-", "");
39+
registerFramework(frameworkName, pkgJson.version);
2940
}

0 commit comments

Comments
 (0)