Front-End/Next.js

[Next.js] Vercel๋กœ ํ”„๋ก ํŠธ ๋ฐฐํฌํ•˜๊ธฐ (๋„๋ฉ”์ธ ๋ณ€๊ฒฝ)

Bigone17 2022. 4. 4. 16:09

 

๐ŸŸก 1. Vercel์ด๋ž€?

  vercel์€ Next.js์—์„œ ๊ณต์‹์ ์œผ๋กœ ์ œ๊ณตํ•˜๋Š” ํ˜ธ์ŠคํŒ… ์‚ฌ์ดํŠธ์ž…๋‹ˆ๋‹ค. Next.js์— ์ตœ์ ํ™”๋˜์–ด ์žˆ๋‹ค ๋ณด๋‹ˆ ์ด๋ฒˆ์— ๋งŒ๋“  ํฌํŠธํด๋ฆฌ์˜ค ์‚ฌ์ดํŠธ๋ฅผ vercel์„ ํ†ตํ•ด์„œ ๋ฐฐํฌํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

๐ŸŸก 2. ๋ฐฐํฌํ•˜๊ธฐ

  ๐ŸŸฃ 2.1 deploy ์ถ”๊ฐ€ํ•˜๊ธฐ

"scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "vercel-deploy": "next build && next export"
}

 ๋ฐฐํฌํ•˜๊ณ ์ž ํ•˜๋Š” ํ”„๋กœ์ ํŠธ์˜ package.jsonํŒŒ์ผ์— script๋ถ€๋ถ„์„ ์œ„์™€ ๊ฐ™์ด ๋ณ€๊ฒฝํ•ด์ค๋‹ˆ๋‹ค. ๋ณดํ†ต์€ vercel-deploy๋งŒ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

๐ŸŸฃ 2.2 Git์— Push ํ•˜๊ธฐ

  ๊ธฐ์กด์— ๋ฐฐํฌํ•˜๊ณ ์ž ํ•˜๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ git์— pushํ•˜์ง€ ์•Š์•˜๋‹ค๋ฉด, ์ƒˆ๋กœ์šด repository๋ฅผ ์ƒ์„ฑํ•˜๊ณ  push ํ•ฉ๋‹ˆ๋‹ค.

 

๐ŸŸฃ 2.3 vercel์— Git Repository ๋“ฑ๋กํ•˜๊ธฐ

 new project ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด, ์•„๋ž˜์™€ ๊ฐ™์ด ์—ฐ๊ฒฐ๋œ github์˜ ๋ ˆํฌ์ง€ํ† ๋ฆฌ ๋ฆฌ์ŠคํŠธ๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค. ๊ทธ์ค‘ ๋ฐฐํฌํ•˜๊ณ ์ž ํ•˜๋Š” ํ”„๋กœ์ ํŠธ ์˜†์— import๋ฅผ ๋ˆ„๋ฆ…๋‹ˆ๋‹ค. 

 

๐ŸŸฃ 2.4 ๋ฐฐํฌํ•˜๊ธฐ

import ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ฒŒ ๋˜๋ฉด ์œ„ ์‚ฌ์ง„๊ณผ ๊ฐ™์€ ํ™”๋ฉด์ด ๋œจ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” ๋”ฐ๋กœ ์ˆ˜์ •ํ•  ๊ฑด ์—†์ด Deploy ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.

 

๐ŸŸฃ 2.5 ๋ฐฐํฌ ํ™•์ธ

๋ฐฐํฌ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์™„๋ฃŒ๊ฐ€ ๋˜๋ฉด ์œ„ ์‚ฌ์ง„๊ณผ ๊ฐ™์€ ํ™”๋ฉด์ด ๋œน๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ DOMAINS ๋ฐ‘์— ๊ธ€์”จ๋Š” ๋ˆ„๋ฅด๋ฉด ๋ฐฐํฌ๋œ ์‚ฌ์ดํŠธ๊ฐ€ ์ƒˆ์ฐฝ์œผ๋กœ ์—ด๋ฆฝ๋‹ˆ๋‹ค.

vercel๋กœ ๋ฐฐํฌํ•œ ํฌํŠธํด๋ฆฌ์˜ค ์‚ฌ์ดํŠธ ์ž…๋‹ˆ๋‹ค.

 

๐ŸŸก 3. ๋„๋ฉ”์ธ ๋ณ€๊ฒฝ

 ๋งŒ์•ฝ ์ž๋™์œผ๋กœ ์™„์„ฑ๋œ ๋„๋ฉ”์ธ์ด ๋งˆ์Œ์— ์•ˆ ๋“ ๋‹ค๋ฉด, ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฐฉ๋ฒ•์œผ๋กœ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  1. ์ž์‹ ์˜ Dashboar
  2. Dashbord ์ค‘ ๋ณ€๊ฒฝํ•˜๊ณ ์ž ํ•˜๋Š” ํ”„๋กœ์ ํŠธ ํด๋ฆญ
  3. ์ƒ๋‹จ ๋ฉ”๋‰ด์—์„œ Settings
  4. ์ขŒ์ธก ๋ฉ”๋‰ด ์ค‘ Domains
  5. Edit
  6. Domain ์ž…๋ ฅ์ฐฝ์— ์›ํ•˜๋Š” Domain ์ฃผ์†Œ ๋„ฃ๊ธฐ

 โ— ์ฃผ์˜์‚ฌํ•ญ : ๋ฌด๋ฃŒ ๋ฒ„์ „์˜ ๊ฒฝ์šฐ ์›ํ•˜๋Š” ์ด๋ฆ„. vercel.app์˜ ํ˜•ํƒœ๋กœ๋งŒ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

 

 

๐Ÿ“ ์ •๋ฆฌ 

  1. package.json์— vercel-deploy ์ถ”๊ฐ€ํ•˜๊ธฐ
  2. github์— ๋ฐฐํฌํ•˜๊ธฐ
  3. vercel๊ณผ github ์—ฐ๋™ํ•˜๊ธฐ
  4. ์›ํ•˜๋Š” ํ”„๋กœ์ ํŠธ vercel์— import ํ›„ deploy ํ•˜๊ธฐ

 

 

 

๊ธด ๊ธ€ ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค :) 
ํ‹€๋ฆฐ ๋‚ด์šฉ์ด ์žˆ๊ฑฐ๋‚˜, ๋ง๋ถ™์ผ ๋‚ด์šฉ์ด ์žˆ๋‹ค๋ฉด ์–ธ์ œ๋“ ์ง€ ๋Œ“๊ธ€ ๋‹ฌ์•„์ฃผ์„ธ์š”!
์ œ ๊ธ€์ด ์กฐ๊ธˆ์ด๋‚˜๋งˆ ์ฝ์œผ์‹  ๋ถ„๋“ค์—๊ฒŒ ๋„์›€์ด ๋˜๋„๋ก ๋…ธ๋ ฅํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค
๋‹ค์Œ ํŽธ์— ๋ดฌ์š”~

728x90
๋ฐ˜์‘ํ˜•

'Front-End > Next.js' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Next.js] Sentry replay ๋„์ž…ํ•˜๊ธฐ  (2) 2023.10.08
[Next.js] Sentry ๋„์ž…ํ•˜๊ธฐ  (5) 2023.10.08
[Next.js] 01. ์‹œ์ž‘ํ•˜๊ธฐ  (2) 2022.03.08