Front-End/Next.js

Next.js] Next.js ์„ค์น˜ ๋ฐ ์‹œ์ž‘, ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ (Insallation)

์™•๊ฐ€๐Ÿ‘ 2023. 8. 9. 00:23
728x90
๋ฐ˜์‘ํ˜•

๊ณตํ™ˆ์„ ๋ณด๋ฉด์„œ ํ•˜๋‚˜์”ฉ ์ •๋ฆฌํ•ด ๋‚˜๊ฐ€๋ณด๋ ค ํ•ฉ๋‹ˆ๋‹ค.

๊ทธ ์‹œ์ž‘์ธ Next.js ์„ค์น˜๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

https://nextjs.org/

 

์ผ๋‹จ ์ œ์ผ ๋จผ์ € Node.js๊ฐ€ ์„ค์น˜ ๋˜์–ด์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

React๊ฐœ๋ฐœ์ž๋ฉด ๋‹น์—ฐํžˆ ์„ค์น˜ ๋ผ์žˆ์„ ๊ฒƒ์œผ๋กœ ์ƒ๊ฐ ๋“ญ๋‹ˆ๋‹ค.(16.8 ๋ฒ„์ „ ์ด์ƒ์ด๋ผ๊ณ  ์•ˆ๋‚ด๋˜์–ด ์žˆ๋„ค์š”)

 

 

 


 

 

 

์ž๋™์„ค์น˜

npx create-next-app@latest

 

์œ„ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด ์ œ์ผ ์ตœ์‹  ๋ฒ„์ „์˜ Next.js๊ฐ€ ์„ค์น˜๋ฉ๋‹ˆ๋‹ค.

 

What is your project named? my-app
Would you like to use TypeScript? No / Yes
Would you like to use ESLint? No / Yes
Would you like to use Tailwind CSS? No / Yes
Would you like to use `src/` directory? No / Yes
Would you like to use App Router? (recommended) No / Yes
Would you like to customize the default import alias? No / Yes
What import alias would you like configured? @/*

 

์ง„ํ–‰ํ•˜๋‹ค ๋ณด๋ฉด ์œ„์™€ ๊ฐ™์ด ์ด๊ฒƒ์ €๊ฒƒ ์„ค์น˜ํ•  ๊ฑด์ง€์— ๋Œ€ํ•ด ๋‚˜์˜ต๋‹ˆ๋‹ค.

Next.js ํŒจ์น˜ ์ง€๋ฅผ ๋งŒ๋“ค๋ฉด์„œ ๊ฐ™์ด ์‚ฌ์šฉํ•  ๊ฒƒ๋“ค๊ณผ ํด๋” ๊ตฌ์กฐ ๋“ฑ์„ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

 

 

 


 

 

 

์ˆ˜๋™์„ค์น˜

์ˆ˜๋™์„ค์น˜ํ•  ์ผ์ด ์žˆ์„์ง€๋Š” ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ...

npm install next@latest react@latest react-dom@latest

 

์œ„ ๋ช…๋ น์–ด๋กœ ์„ค์น˜ํ•ด ์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

์ถ”๊ฐ€๋กœ ํ”„๋กœ์ ํŠธ ์‹คํ–‰ ๋ช…๋ น์–ด๋‚˜ ํด๋” ๊ตฌ์กฐ ๋“ฑ์„ ์ง์ ‘ ๋งŒ๋“ค์–ด์•ผ ๋˜๋Š” ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค.

ํ•ด๋‹น ๋ถ€๋ถ„์€ ๋„˜์–ด๊ฐ€๊ฒ ์Šต๋‹ˆ๋‹ค.

 

 

 

 

 

 

๋ช…๋ น์–ด

"scripts": {
  "dev": "next dev",  // Next.js development ๋ชจ๋“œ
  "build": "next build",  // Production์šฉ build
  "start": "next start",  // Production์šฉ start
  "lint": "next lint"  // Next.js์— ๋‚ด์žฅ๋˜์–ด ์žˆ๋Š” ESLint๊ตฌ์„ฑ์„ ์„ค์ •ํ•˜๊ธฐ ์œ„ํ•ด ์‹คํ–‰
}

 

package.json ํŒŒ์ผ์„ ์—ด์–ด ๋ณด๋ฉด ์œ„์™€ ๊ฐ™์ด ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์ž‘์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ฃผ์„๊ณผ ๊ฐ™์ด ์•ˆ๋‚ด๋˜์–ด ์žˆ๊ณ , lint ๋นผ๊ณ ๋Š” ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋“ค์ž…๋‹ˆ๋‹ค. (์ €๋งŒ ์•ˆ ์จ ๋ณธ๊ฑฐ์ผ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.)

 

 

 


 

 

 

์‹คํ–‰

๊ทธ๋Ÿฌ๋ฉด ์ด์ œ ์œ„ ๋ช…๋ น์–ด ์ค‘ npm run dev๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ํ”„๋กœ์ ํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋ฉด Next.js์—์„œ ๋งŒ๋“ค์–ด ๋†“์€ ๊ธฐ๋ณธ ํŽ˜์ด์ง€๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

ํ•ด๋‹น ํŽ˜์ด์ง€๋Š” app/layout.tsx์—์„œ ํŽธ์ง‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

 

 

 

728x90

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

Next.js] ํ”„๋กœ์ ํŠธ ํด๋” ๊ตฌ์กฐ  (0) 2023.08.15
Next.js] Next.js๋ž€?  (0) 2023.08.06