OS Mac Monterey Tool Visual Studio Code Node 16.13.2
NextJS 공식 홈페이지에서 CNA(Create Next App)
명령어를 통해 NextJS 기반 프로젝트 초기 설정을 해줍니다.
yarn create next-app --typescript
React 18 버전을 사용하기 위해 라이브러리 버전 올려 설치해줍니다.
작성하는 시점에서는 18버전이 정식 릴리즈가 되지 않아 RC 버전 을 설치해줍니다.
yarn add next@latest react@rc react-dom@rc
TailwindCSS Documents - Using PostCSS에 나온 순서를 참고하여 TailwindCSS 초기 설정을 해줍니다.
yarn add --dev tailwindcss postcss autoprefixer
TailwindCSS Content Configuration
TailwindCSS가 사용되는 파일을 인지할 수 있도록 tailwind.config.js
파일에서 설정해줍니다.
루트 경로와 CSS 경로를 포함하면 안됩니다.
module.exports = {
content: [
'./pages/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
],
...
}