๋ฐฉ๋ฒ1. ๋ช ๋ น์ด๋ก ์คํ (1ํ์ฑ)
PORT=[์ซ์] npm run start
๋ฐฉ๋ฒ2. package.json ์์
window
...
"scripts": {
"start": "set PORT=3002 && react-scripts start",
}
...
๋ฐฉ๋ฒ3. ํ๋ก์ ํธ๋ช /node_modules/react-scripts/scripts/start.js ์์ ํ๊ธฐ
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3002; // ์์
const HOST = process.env.HOST || '0.0.0.0';
๋ฐฉ๋ฒ4. .env ํ์ผ ์์ฑํ๊ณ port ์ค์ ํ๊ธฐ
ํ๋ก์ ํธ๋ช /.env
PORT=3002
๋ช ๋ น์ด๋ก ์คํ
npm run start
Reference
'Development > React.js' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[React] console.log(useRef) (0) | 2023.01.25 |
---|---|
[React] ref, useRef (0) | 2023.01.24 |
[React] React Hook API (0) | 2023.01.18 |
[React] React Life Cycle ; ๋ฆฌ์กํธ ์๋ช ์ฃผ๊ธฐ (0) | 2023.01.14 |
SPA / CSR / TTI / TTV / SEO / Metaํ๊ทธ / Opengraph (0) | 2022.10.14 |
๋๊ธ