Skip to content

Commit

Permalink
Merge pull request #5 from JSH99/feat/config
Browse files Browse the repository at this point in the history
.env 파일 연결 오류를 수정한다.
  • Loading branch information
minseokiim authored Sep 13, 2023
2 parents fe4847a + 40b6fd7 commit df01a5e
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 572 deletions.
610 changes: 54 additions & 556 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"preview": "vite preview"
},
"dependencies": {
"firebase": "^10.3.1",
"@types/marked": "^5.0.1",
"firebase": "^10.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.11.0",
Expand Down
2 changes: 2 additions & 0 deletions src/common/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
## 공용으로 사용하는 나머지

import {auth, db, storage} from '../common/config';
19 changes: 10 additions & 9 deletions src/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import { getAuth } from 'firebase/auth';
import { getFirestore } from 'firebase/firestore';
import { getStorage } from 'firebase/storage';

export const firebaseConfig = {
apiKey: process.env.API_KEY,
authDomain: process.env.AUTH_DOMAIN,
projectId: process.env.PROJECT_ID,
storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: process.env.MESSAGING_SENDER_ID,
appId: process.env.APP_ID,
measurementId: process.env.MEASUREMENT_ID,
const firebaseConfig = {
apiKey: import.meta.env.VITE_API_KEY,
authDomain: import.meta.env.VITE_AUTH_DOMAIN,
projectId: import.meta.env.VITE_PROJECT_ID,
storageBucket: import.meta.env.VITE_STORAGE_BUCKET,
messagingSenderId: import.meta.env.VITE_MESSAGING_SENDER_ID,
appId: import.meta.env.VITE_APP_ID,
measurementId: import.meta.env.VITE_MEASUREMENT_ID,
};

export const app = initializeApp(firebaseConfig);
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
export const db = getFirestore(app);
export const storage = getStorage(app);
export default app;
13 changes: 13 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
interface ImportMetaEnv {
readonly VITE_APP_API_KEY: string;
readonly VITE_AUTH_DOMAIN: string;
readonly VITE_PROJECT_ID: string;
readonly VITE_STORAGE_BUCKET: string;
readonly VITE_MESSAGING_SENDER_ID: string;
readonly VITE_APP_ID: string;
readonly VITE_MEASUREMENT_ID: string;
}

interface ImportMeta {
readonly env: ImportMetaEnv;
}
2 changes: 2 additions & 0 deletions src/pages/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import userState from '../hooks/user';

const Login = () => {
userState();
return <div>Login</div>;
};

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
"noFallthroughCasesInSwitch": true
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
"references": [{ "path": "./tsconfig.node.json" }],
"lib": ["WebWorker"]
}
13 changes: 8 additions & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react-swc';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
return {
plugins: [react()],
};
});

0 comments on commit df01a5e

Please sign in to comment.