Skip to content

Commit 770943e

Browse files
authored
Merge pull request #118 from Soohyuniii/fix/hmr-설정-변경
fix: hmr 설정 변경
2 parents 19c02a8 + 64dcff2 commit 770943e

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ jobs:
2525
npm install tailwindcss@latest postcss@latest autoprefixer@latest
2626
npm install --save-dev @types/node
2727
28+
- name: Create .env file # env 파일 생성 단계 추가
29+
run: |
30+
echo "VITE_GA_MEASUREMENT_ID=${{ secrets.VITE_GA_MEASUREMENT_ID }}" > .env
31+
2832
- name: Run build
2933
run: npm run build --verbose # 프로젝트에 맞는 빌드 명령어
30-
env:
31-
VITE_GA_MEASUREMENT_ID: ${{ secrets.VITE_GA_MEASUREMENT_ID }} # Google Analytics 환경 변수 사용
3234

3335
- name: Docker build & push
3436
run: |

src/libs/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ReactGA from "react-ga4";
22

33
const GA_MEASUREMENT_ID = import.meta.env.VITE_GA_MEASUREMENT_ID || "";
44

5-
const isProduction = process.env.NODE_ENV === "production";
5+
const isProduction = import.meta.env.MODE === "production";
66

77
const initGA = () => {
88
if (isProduction && GA_MEASUREMENT_ID) {

vite.config.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ export default defineConfig(({ mode }: { mode: string }) => {
1919
strictPort: true,
2020
allowedHosts: ["mbtips.kr"],
2121
hmr: isProduction
22-
? false // 배포 환경에서는 HMR 비활성화 (WebSocket 사용 안 함)
22+
? {
23+
host: "mbtips.kr",
24+
protocol: "wss"
25+
}
2326
: {
2427
host: "localhost",
2528
protocol: "wss"
@@ -60,11 +63,6 @@ export default defineConfig(({ mode }: { mode: string }) => {
6063
replacement: path.resolve(__dirname, "src/libs")
6164
}
6265
]
63-
},
64-
define: {
65-
"process.env.VITE_GA_MEASUREMENT_ID": JSON.stringify(
66-
process.env.VITE_GA_MEASUREMENT_ID
67-
)
6866
}
6967
};
7068
});

0 commit comments

Comments
 (0)