Skip to content

Commit 4d526c2

Browse files
authored
fix(core,react): Statically replace import.meta.env at build time
2 parents fb9676d + 60914c7 commit 4d526c2

File tree

11 files changed

+47
-131
lines changed

11 files changed

+47
-131
lines changed

examples/nextjs-ssr/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"deploy": "pnpm run build && firebase deploy --only hosting:fir-ui-rework-nextjs-ssr"
1414
},
1515
"dependencies": {
16-
"@invertase/firebaseui-react": "latest",
17-
"@invertase/firebaseui-core": "latest",
18-
"@invertase/firebaseui-styles": "latest",
19-
"@invertase/firebaseui-translations": "latest",
16+
"@invertase/firebaseui-react": "workspace:*",
17+
"@invertase/firebaseui-core": "workspace:*",
18+
"@invertase/firebaseui-styles": "workspace:*",
19+
"@invertase/firebaseui-translations": "workspace:*",
2020
"firebase": "^11.10.0",
2121
"next": "15.1.7",
2222
"react": "19.1.1",

examples/nextjs/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"deploy": "pnpm run build && firebase deploy --only hosting:fir-ui-rework-nextjs-ssg"
1414
},
1515
"dependencies": {
16-
"@invertase/firebaseui-react": "latest",
17-
"@invertase/firebaseui-core": "latest",
18-
"@invertase/firebaseui-styles": "latest",
19-
"@invertase/firebaseui-translations": "latest",
16+
"@invertase/firebaseui-react": "workspace:*",
17+
"@invertase/firebaseui-core": "workspace:*",
18+
"@invertase/firebaseui-styles": "workspace:*",
19+
"@invertase/firebaseui-translations": "workspace:*",
2020
"firebase": "catalog:",
2121
"next": "15.1.7",
2222
"react": "catalog:",

examples/react/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"deploy": "pnpm run build && firebase deploy --only hosting:fir-ui-2025-react"
1212
},
1313
"dependencies": {
14-
"@invertase/firebaseui-react": "latest",
15-
"@invertase/firebaseui-core": "latest",
16-
"@invertase/firebaseui-styles": "latest",
17-
"@invertase/firebaseui-translations": "latest",
14+
"@invertase/firebaseui-react": "workspace:*",
15+
"@invertase/firebaseui-core": "workspace:*",
16+
"@invertase/firebaseui-styles": "workspace:*",
17+
"@invertase/firebaseui-translations": "workspace:*",
1818
"firebase": "^11.6.0",
1919
"react": "catalog:",
2020
"react-dom": "catalog:",

packages/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@invertase/firebaseui-angular",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"files": [
55
"dist"
66
],

packages/core/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@invertase/firebaseui-core",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"description": "Core authentication service for Firebase UI",
55
"type": "module",
66
"main": "./dist/index.cjs",
@@ -21,7 +21,7 @@
2121
"scripts": {
2222
"prepare": "pnpm run build",
2323
"emulators:start": "firebase emulators:start -P demo-firebaseui",
24-
"build": "tsup",
24+
"build": "tsup --env.PROD=true",
2525
"build:local": "pnpm run build && pnpm pack",
2626
"dev": "tsup --watch",
2727
"lint": "eslint . --ext .ts",

packages/core/src/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ export * from "./register-framework";
2727
export * from "./schemas";
2828
export * from "./translations";
2929

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-
const isViteProduction =
34-
typeof import.meta !== "undefined" &&
35-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
36-
(import.meta as any)?.env &&
37-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
38-
(import.meta as any).env.PROD === true;
39-
40-
// Check if in production mode
41-
const isProduction = isDevelopment || isViteProduction;
42-
43-
if (isProduction) {
44-
// Extract framework name from package name (e.g., "@invertase/firebaseui-react" -> "react")
45-
const frameworkName = pkgJson.name.replace("@invertase/firebaseui-", "");
46-
registerFramework(frameworkName, pkgJson.version);
30+
if (import.meta.env.PROD) {
31+
registerFramework("core", pkgJson.version);
4732
}

packages/react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@invertase/firebaseui-react",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"type": "module",
55
"main": "./dist/index.cjs",
66
"module": "./dist/index.js",
@@ -17,7 +17,7 @@
1717
],
1818
"scripts": {
1919
"prepare": "pnpm run build",
20-
"build": "tsup && pnpm run build:logos",
20+
"build": "tsup --env.PROD=true && pnpm run build:logos",
2121
"build:local": "pnpm run build && pnpm pack",
2222
"build:logos": "pnpm dlx @svgr/cli --icon --typescript --no-index --jsx-runtime automatic --out-dir src/components/logos ../core/brands",
2323
"dev": "tsup --watch",

packages/react/src/index.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@ export { PolicyContext } from "./components/policies";
2424
export { FirebaseUIProvider, type FirebaseUIProviderProps } from "./context";
2525
export * from "./hooks";
2626

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-
const isViteProduction =
31-
typeof import.meta !== "undefined" &&
32-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33-
(import.meta as any)?.env &&
34-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
35-
(import.meta as any).env.PROD === true;
36-
37-
// Check if in production mode
38-
const isProduction = isNodeProduction || isViteProduction;
39-
40-
if (isProduction) {
41-
// Extract framework name from package name (e.g., "@invertase/firebaseui-react" -> "react")
42-
const frameworkName = pkgJson.name.replace("@invertase/firebaseui-", "");
43-
registerFramework(frameworkName, pkgJson.version);
27+
if (import.meta.env.PROD) {
28+
registerFramework("react", pkgJson.version);
4429
}

packages/styles/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@invertase/firebaseui-styles",
3-
"version": "0.0.12",
3+
"version": "0.0.13",
44
"type": "module",
55
"zshy": {
66
"exports": {

packages/translations/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@invertase/firebaseui-translations",
3-
"version": "0.0.7",
3+
"version": "0.0.8",
44
"description": "Translations for Firebase UI",
55
"type": "module",
66
"main": "./dist/index.cjs",

0 commit comments

Comments
 (0)