From 96cb9e52b1a46b829d4c23393b891c77df4ac47e Mon Sep 17 00:00:00 2001 From: Alex Personal Date: Tue, 23 Jan 2024 09:42:59 +1300 Subject: [PATCH] changed port 5001 back to 5000 --- frontend/.env | 2 +- frontend/firebase.json | 2 +- .../{ => sign-up-form}/SignUpForm.tsx | 2 +- frontend/src/firebase.ts | 5 ++--- frontend/src/pages/Register.tsx | 2 +- frontend/src/vite.config.ts | 21 ++++++++++++------- 6 files changed, 20 insertions(+), 14 deletions(-) rename frontend/src/components/{ => sign-up-form}/SignUpForm.tsx (99%) diff --git a/frontend/.env b/frontend/.env index 06cbcf4b0..4f42b8006 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1,2 +1,2 @@ VITE_FIREBASE_API_KEY=AIzaSyAVkhnuTBofnvjRXzwB9YmPKzkZm3Pa920 -NODE_ENV=production \ No newline at end of file +VITE_ENV=production \ No newline at end of file diff --git a/frontend/firebase.json b/frontend/firebase.json index a3bf86f90..522415954 100644 --- a/frontend/firebase.json +++ b/frontend/firebase.json @@ -21,7 +21,7 @@ "port": 8080 }, "hosting": { - "port": 5001 + "port": 5000 }, "ui": { "enabled": true diff --git a/frontend/src/components/SignUpForm.tsx b/frontend/src/components/sign-up-form/SignUpForm.tsx similarity index 99% rename from frontend/src/components/SignUpForm.tsx rename to frontend/src/components/sign-up-form/SignUpForm.tsx index 2992ce1ab..1ec7f68a1 100644 --- a/frontend/src/components/SignUpForm.tsx +++ b/frontend/src/components/sign-up-form/SignUpForm.tsx @@ -5,7 +5,7 @@ import { updateProfile, } from "firebase/auth" import { useNavigate } from "react-router-dom" -import { db } from "../firebase" +import { db } from "../../firebase" import { setDoc, doc } from "firebase/firestore" import Button from "@mui/material/Button" import TextField from "@mui/material/TextField" diff --git a/frontend/src/firebase.ts b/frontend/src/firebase.ts index 0a42284c1..086b2987e 100644 --- a/frontend/src/firebase.ts +++ b/frontend/src/firebase.ts @@ -3,10 +3,9 @@ import { initializeApp } from "@firebase/app" import { getAuth, connectAuthEmulator } from "@firebase/auth" import { getFirestore, connectFirestoreEmulator } from "@firebase/firestore" +// @ts-ignore const firebaseApiKey = import.meta.env.VITE_FIREBASE_API_KEY -console.log(import.meta.env) - const firebaseConfig = { apiKey: firebaseApiKey, authDomain: "uasc-ceebc.firebaseapp.com", @@ -21,7 +20,7 @@ const auth = getAuth(app) const db = getFirestore(app) // use emulator suite if running locally -if (process.env.NODE_ENV === "development") { +if (import.meta.env.VITE_ENV === "development") { connectFirestoreEmulator(db, "localhost", 8080) connectAuthEmulator(auth, "http://localhost:9099") } diff --git a/frontend/src/pages/Register.tsx b/frontend/src/pages/Register.tsx index 0d45897b1..af6aeafea 100644 --- a/frontend/src/pages/Register.tsx +++ b/frontend/src/pages/Register.tsx @@ -1,5 +1,5 @@ import React from "react" -import SignUpForm from "../components/SignUpForm" +import SignUpForm from "../components/sign-up-form/SignUpForm" import Typography from "@mui/material/Typography" import Container from "@mui/material/Container" import Box from "@mui/material/Box" diff --git a/frontend/src/vite.config.ts b/frontend/src/vite.config.ts index 0537cfaa7..c49d83ce5 100644 --- a/frontend/src/vite.config.ts +++ b/frontend/src/vite.config.ts @@ -1,8 +1,15 @@ -const { loadEnvConfig } = require("next-env") +import { defineConfig } from "vite" +import react from "@vitejs/plugin-react" +import viteTsconfigPaths from "vite-tsconfig-paths" -const withEnv = () => { - const env = loadEnvConfig(__dirname) - return { env: env.parsed } -} - -module.exports = withEnv() +export default defineConfig({ + // depending on your application, base can also be "/" + base: "", + plugins: [react(), viteTsconfigPaths()], + server: { + // this ensures that the browser opens upon server start + open: true, + // this sets a default port to 3000 + port: 3000, + }, +})