๋ชจ๋ ธ๋ ํฌ ๊ตฌ์กฐ์์ ์ธํ ๋ ESLint ์ค๋ฅ๊ฐ ํ๋ฉด์ ๋ณด์ด์ง ์๋ ๋ฌธ์
ํ์ฌ ์งํ์ค์ธ ํ๋ก์ ํธ์์๋ ๋ชจ๋ ธ๋ ํฌ ๊ตฌ์กฐ๋ฅผ ์ฑํํ์ฌ ๊ฐ๋ฐ์ ์ด์ด๋๊ฐ๊ณ ์๋๋ฐ, ์ด์ํ๊ฒ ESlint ์ค๋ฅ๊ฐ ๋ณด์ด์ง ์์์ต๋๋ค.
๊ทผ๋ฐ ๋ ๋ค ์๋ณด์ด๋ ๊ฒ๋ ์๋๊ณ , ๋ช๊ฐ๋ ๋ณด์ด๊ณ ๋ช๊ฐ๋ ๋ณด์ด์ง ์๋ ๋ฌธ์ ๋ ๋ฐ์ํ๊ตฌ์.
๋ ํ๋ฉด์๋ ๋ค ์์กํ์ง๋ง eslint ๋ช ๋ น์ด๋ฅผ ํตํด ํ์ธํ๋ฉด ๋ณด์ด์ง ์๋ ์ค๋ฅ๊ฐ ๋ค ๋ฐ๊ฒฌ๋์์ต๋๋ค.
์ด ๋ถ๋ถ์์ ์ ๋ eslint ๊ธฐ๋ฅ์ ๋ฌธ์ ๋ผ๊ธฐ๋ณด๋จ IDE๋ฅผ ์์ฌํ๊ธฐ ์์ํ์ต๋๋ค.
๊ทผ๋ฐ ๋ณดํต IDE๋ฅผ ์์ฌํ๊ฒ๋๋ฉด '๋ด IDE ์ค์ ์ ์๋ชป'์ผ๋ก ์ดํดํ์ง, ๋ค๋ฅธ ์ฌ๋๋ค๊น์ง ๊ทธ๋ด๊ฑฐ๋ผ๊ณ ๋ ์๊ฐํ์ง ์์์์.
์ ๋ฅผ ๋ ํผ๋์ค๋ฝ๊ฒ ๋ง๋ค์๋ ๊ฑด, ๋ค๋ฅธ ํ์๋ค๋ ESlint ์ค๋ฅ๊ฐ ๋ณด์ด์ง ์์์ต๋๋ค. ๋ชจ๋ ๊ฐ์ ์ฆ์์ด์๋ค๋ ๊ฒ์ด์ฃ .
๊ทธ๋ฅ ๋ฌด์ํ๊ณ ๋์ด๊ฐ๊ณ ์ถ์์ผ๋ ํด๋น ํ๋ก์ ํธ์ ์ถ๊ฐ์ ์ผ๋ก ์ ์ฉ๋์ด์๋ husky์์ lint-staged ์์ ๊ณ์ ์ก์ผ๋ ์ปค๋ฐ ์์ฒด๊ฐ ๋์ง ์์ ํด๊ฒฐํ์ง ์๊ณ ์๋ ๋์ด๊ฐ ์ ์์์ต๋๋ค.
๊ทธ๋ฌ๋ค ๋ฐ๊ฒฌํ ๊ธ์ด ํ๋ ์์์ต๋๋ค. ๋ฐ๋ก ๋ชจ๋ ธ๋ ํฌ ๊ตฌ์กฐ์์ VSCODE์ eslint extension์ ๋ฌธ์ ๊ฐ ์๋ค๋ ์ด์ผ๊ธฐ์์ต๋๋ค.
์์ฑ์๋ถ๊ฒ์๋ turborepo๋ฅผ ์ฌ์ฉ์ค์ ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌํ์ จ์ง๋ง ๋น๋จ turborepo์ ๋ฌธ์ ๋ง์ ์๋๊ณ ๋ชจ๋ ธ๋ ํฌ๋ฅผ ์ฌ์ฉํ๋ฉด ๊ฒช์ ์ ์๋ ๋ฌธ์ ์ผ ๊ฑฐ๋ผ๊ณ ํ์ จ๋๋ฐ ๋ง์์ต๋๋ค.
์ ๋ pnpm์ ํตํด ๋ชจ๋ ธ๋ ํฌ๋ฅผ ๊ตฌ์ฑํ๊ณ ์์๊ฑฐ๋ ์.
์ ๊ธ์ด ๊ธฐ๋ ์์ฝ์ ํด๋ณด์๋ฉด,
- ๋ชจ๋ ธ๋ ํฌ ํ๊ฒฝ์์ ํน์ eslint์ config๋ฅผ extension์ ๋ฃ๊ณ ์ถ๊ฐ์ ์ผ๋ก @typescript-eslint/parser๋ฅผ ์ฌ์ฉํ๋ฉฐ, parserOptions.project๋ฅผ ์ค์ ํด์ค์ผ ํ ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
- ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด์๋ VSCODE์์ eslint ์ต์ ์์ workingDirectories์ ๊ฐ์ auto๋ก ์ค์ ํด์ฃผ์ด์ผ ํฉ๋๋ค.
์ด ๊ธ์ ๋ณด๋ฉด์ ์ถ๊ฐ์ ์ผ๋ก ์ธ์งํ ์ ์์๋ ์ฌ์ค์, ์ด๋ถ๊ณผ ๋ด๊ฐ ๋ชจ๋ airbnb ๋ฆฐํธ ์ค์ ์ ์ฌ์ฉํ๊ณ ์์๋ค๋ ์ ์ ๋๋ค.
๋, airbnb ๋ฆฐํธ ์ค์ ์ ํ๊ธฐ ์ ์๋ eslint ์๋ฌ๊ฐ ์ ์์ ์ผ๋ก ํ์๋์๋ค๋ ์ (์ด๋ถ๋ turborepo ๊ธฐ๋ณธ๊ฐ์์๋ ์ ์์ ์ผ๋ก ๋์ํ๋ค๊ณ ํด์)
์์ ์ด์ ๋ฅผ ๋ฏธ๋ฃจ์ด๋ณด์ airbnb lint ์ค์ ๋ด์ง plugin๊ฐ์ ์ถฉ๋์ด ๋ฐ์ํ๊ณ ์์์ ์ ์ ์์์ต๋๋ค.
์๊ฐ์ด ๋๋ฉด ์ด๋ฅผ ๋ถ์ํด์ ๊ธฐ์ฌ๋ฅผ ์ข ํด๋ณด๊ณ ์ถ์๋ฐ.. ์ผ๋จ ํ๋ก์ ํธ ๊ฐ๋ฐ์ ๋๋ด๊ณ ์๊ฐํด๋ด์ผ๊ฒ ์ต๋๋ค.
MSW - Next๊ฐ์ ์ถฉ๋ ๋ฌธ์
API ๋ชจํน์ ํ๊ธฐ ์ํด ์ฌ์ ์ next ํ๋ก์ ํธ์์ msw ์ธํ ์ ํด์ฃผ์๋๋ฐ, ์ ํ๊ฒฝ์์ ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
โจฏ SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON at JSON.parse (<anonymous>) at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
โจฏ TypeError: Cannot read properties of null (reading 'useContext') at t.useContext (/Users/swarvy/Repository/attraction_fe/node_modules
์ผ๋จ ์์ ๋ด์ฉ๋ถํฐ ์ค๋ช ์ ๋๋ฆฌ๋ฉด, ์ ํฌ ํ๋ก์ ํธ์์๋ msw ์ธํ ์ server๋ง ์ธํ ํ๊ณ browser ์ธํ ์ ํ์ง ์์์ผ๋ฉฐ, ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ๋์ฑ ์ผ๋ก Next์ reWrite ๊ธฐ๋ฅ์ ์ฌ์ฉํ์ต๋๋ค.
์ผ์ข ์ ํ๋ก์ ๊ธฐ๋ฅ์ธ๋ฐ, ์ ๊ฐ ์๊ฐํ์ ๋ msw๋ ์์ฒญ์ด ๋ฐ์ํ๋ฉด ํด๋น ์์ฒญ์ ์ธํฐ์ ํธํ์ฌ ์๋ต์ ์ฃผ๋ ๊ฒ ์ด๊ธฐ ๋๋ฌธ์ ๋ณ๋์ ํ๋ก์๋ ํ์ํ์ง ์๋ค๊ณ ์๊ฐํ์ต๋๋ค.
๋, ์ ํ๊ฒฝ์์ MSW๋ก ํฅํ๋ api ์์ฒญ์ ํ๋ผ๋ฏธํฐ๊ฐ 2๋ฒ์ฉ ๋ค์ด๊ฐ๋ ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌ, ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด reWrite ๊ธฐ๋ฅ์ ์ง์ฐ๊ณ ์คํ์ ์์ผฐ์ต๋๋ค.
reWrite๋ฅผ ํตํด ์คํ์์ผฐ์ ๋ ์ ์์ ์ผ๋ก ๋์ํ๋๊ฐ ์ถ์๋๋ ์์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉฐ ๊ฐํ์ ์ผ๋ก ํ์ด์ง ๋ ๋๋ง์ด ๋์ง ์๋ ๋ฌธ์ ๋ฅผ ํ์ธํ์ต๋๋ค.
์ด์๋ฅผ ํ์ธํด ๋ณธ ๊ฒฐ๊ณผ MSW์์ Next app router๋ฅผ ์๋ฒฝํ๊ฒ ์ง์ํ๊ณ ์์ง ์์ผ๋ฉฐ + ์ฌ์ฉํ๊ธฐ ์ํด์๋ browser worker์ server๋ฅผ ๋ชจ๋ ์ค์ ํด์ผ ํ๋ค๋ ๊ฒ ์ด์์ต๋๋ค.
์์ฝ๊ฒ๋ ์ ํฌ ํ๋ก์ ํธ๋ ํด๋น ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฌ์ฉํด๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๋ค.
๋ ํ๋ณด๊ณ ์ถ์์ง๋ง ์ ์ด์ MSW์์ ์์ง App router๋ฅผ ์ ์์ง์ํ์ง ์๊ณ ์์ผ๋ฉฐ, ์์ ๋ ์๋ฌ๋ Next ์์ฒด์ ์๋ฌ์ ๊ฐ๊น์ ๊ธฐ๋๋ฌธ์ ์ ํฌ ์์ค์์๋ ํด๊ฒฐ์ด ํ๋ค๋ค๊ณ ๋ณด์๊ณ ,
๋ฐฉ๋ฒ์ด ์๋ ๊ฒ ๊ฐ์ง ์์ง๋ง, ํ๋ก์ ํธ ์งํ์ค์ด๊ธฐ๋๋ฌธ์ msw์ ์ด ์ด์ ์๊ฐ์ด ๋ค์ด๊ฐ๋ค๋ฉด ์๋ ๊ฒ ๊ฐ์ ์ผ๋จ ํด๋น ๋ฌธ์ ๋ ๊ฑด๋๋ฐ๊ณ ๋ค์์ ์ฐพ์๋ณด๊ธฐ๋ก ํ์ต๋๋ค.
์ ๋ ์๋ ์ด์๋ฅผ ํ์ตํ ๋ค ๋ค์ ํ๋ก์ ํธ ๋ ์ ์ฉํด๋ณผ ์์ ์ ๋๋ค.
- TypeError: Cannot read properties of null reading 'useContext'
- Next.js Project Fails to Compile due to Package path ./browser is not exported from package /node_modules/msw
- Support Next.js 13 App Router
next lint๋ ๋ชจ๋๋ฅผ ๊ฒ์ฌํ์ง ์์
์์ lint ๋ฌธ์ ์ ์ฐ๊ณ๋๋ ์ฌํญ์ด์๋๋ฐ, next lint๋ฅผ ์ฐ์๋๋ฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง ์๋๊ฑธ ํ์ธํ์์๋ ๋ถ๊ตฌํ๊ณ eslint ์ปค๋งจ๋๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฆฐํธ ์๋ฌ๊ฐ ๋ฐ๊ฒฌ๋์์ต๋๋ค. ํด๋น ๋ด์ฉ์ ๋ํด์ ๋ ์ฐพ์๋ณธ ๊ฒฐ๊ณผ…
next lint์ ๊ฒฝ์ฐ์๋ ๊ธฐ๋ณธ์ ์ผ๋ก pages/, app/, components/, lib/, src/ ๋ง์ ๊ฒ์ฌํ๋ค๋ ๊ฒ ์ด์์ต๋๋ค.
ํด๋น ๋ด์ฉ์ ํ์ธํ๊ณ ์ปค๋งจ๋๋ฅผ ๋ณ๊ฒฝํ๋๋ ์ ์์ ์ผ๋ก eslint๋ฅผ ํตํด ๋ก์ง์ ๊ฒ์ฌํ ์ ์์์ต๋๋ค.
๋ชจ๋ ธ๋ ํฌ ๊ตฌ์กฐ์์ ์ธํ ๋ ESLint ์ค๋ฅ๊ฐ ํ๋ฉด์ ๋ณด์ด์ง ์๋ ๋ฌธ์
ํ์ฌ ์งํ์ค์ธ ํ๋ก์ ํธ์์๋ ๋ชจ๋ ธ๋ ํฌ ๊ตฌ์กฐ๋ฅผ ์ฑํํ์ฌ ๊ฐ๋ฐ์ ์ด์ด๋๊ฐ๊ณ ์๋๋ฐ, ์ด์ํ๊ฒ ESlint ์ค๋ฅ๊ฐ ๋ณด์ด์ง ์์์ต๋๋ค.
๊ทผ๋ฐ ๋ ๋ค ์๋ณด์ด๋ ๊ฒ๋ ์๋๊ณ , ๋ช๊ฐ๋ ๋ณด์ด๊ณ ๋ช๊ฐ๋ ๋ณด์ด์ง ์๋ ๋ฌธ์ ๋ ๋ฐ์ํ๊ตฌ์.
๋ ํ๋ฉด์๋ ๋ค ์์กํ์ง๋ง eslint ๋ช ๋ น์ด๋ฅผ ํตํด ํ์ธํ๋ฉด ๋ณด์ด์ง ์๋ ์ค๋ฅ๊ฐ ๋ค ๋ฐ๊ฒฌ๋์์ต๋๋ค.
์ด ๋ถ๋ถ์์ ์ ๋ eslint ๊ธฐ๋ฅ์ ๋ฌธ์ ๋ผ๊ธฐ๋ณด๋จ IDE๋ฅผ ์์ฌํ๊ธฐ ์์ํ์ต๋๋ค.
๊ทผ๋ฐ ๋ณดํต IDE๋ฅผ ์์ฌํ๊ฒ๋๋ฉด '๋ด IDE ์ค์ ์ ์๋ชป'์ผ๋ก ์ดํดํ์ง, ๋ค๋ฅธ ์ฌ๋๋ค๊น์ง ๊ทธ๋ด๊ฑฐ๋ผ๊ณ ๋ ์๊ฐํ์ง ์์์์.
์ ๋ฅผ ๋ ํผ๋์ค๋ฝ๊ฒ ๋ง๋ค์๋ ๊ฑด, ๋ค๋ฅธ ํ์๋ค๋ ESlint ์ค๋ฅ๊ฐ ๋ณด์ด์ง ์์์ต๋๋ค. ๋ชจ๋ ๊ฐ์ ์ฆ์์ด์๋ค๋ ๊ฒ์ด์ฃ .
๊ทธ๋ฅ ๋ฌด์ํ๊ณ ๋์ด๊ฐ๊ณ ์ถ์์ผ๋ ํด๋น ํ๋ก์ ํธ์ ์ถ๊ฐ์ ์ผ๋ก ์ ์ฉ๋์ด์๋ husky์์ lint-staged ์์ ๊ณ์ ์ก์ผ๋ ์ปค๋ฐ ์์ฒด๊ฐ ๋์ง ์์ ํด๊ฒฐํ์ง ์๊ณ ์๋ ๋์ด๊ฐ ์ ์์์ต๋๋ค.
๊ทธ๋ฌ๋ค ๋ฐ๊ฒฌํ ๊ธ์ด ํ๋ ์์์ต๋๋ค. ๋ฐ๋ก ๋ชจ๋ ธ๋ ํฌ ๊ตฌ์กฐ์์ VSCODE์ eslint extension์ ๋ฌธ์ ๊ฐ ์๋ค๋ ์ด์ผ๊ธฐ์์ต๋๋ค.
์์ฑ์๋ถ๊ฒ์๋ turborepo๋ฅผ ์ฌ์ฉ์ค์ ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌํ์ จ์ง๋ง ๋น๋จ turborepo์ ๋ฌธ์ ๋ง์ ์๋๊ณ ๋ชจ๋ ธ๋ ํฌ๋ฅผ ์ฌ์ฉํ๋ฉด ๊ฒช์ ์ ์๋ ๋ฌธ์ ์ผ ๊ฑฐ๋ผ๊ณ ํ์ จ๋๋ฐ ๋ง์์ต๋๋ค.
์ ๋ pnpm์ ํตํด ๋ชจ๋ ธ๋ ํฌ๋ฅผ ๊ตฌ์ฑํ๊ณ ์์๊ฑฐ๋ ์.
์ ๊ธ์ด ๊ธฐ๋ ์์ฝ์ ํด๋ณด์๋ฉด,
- ๋ชจ๋ ธ๋ ํฌ ํ๊ฒฝ์์ ํน์ eslint์ config๋ฅผ extension์ ๋ฃ๊ณ ์ถ๊ฐ์ ์ผ๋ก @typescript-eslint/parser๋ฅผ ์ฌ์ฉํ๋ฉฐ, parserOptions.project๋ฅผ ์ค์ ํด์ค์ผ ํ ๋ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
- ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด์๋ VSCODE์์ eslint ์ต์ ์์ workingDirectories์ ๊ฐ์ auto๋ก ์ค์ ํด์ฃผ์ด์ผ ํฉ๋๋ค.
์ด ๊ธ์ ๋ณด๋ฉด์ ์ถ๊ฐ์ ์ผ๋ก ์ธ์งํ ์ ์์๋ ์ฌ์ค์, ์ด๋ถ๊ณผ ๋ด๊ฐ ๋ชจ๋ airbnb ๋ฆฐํธ ์ค์ ์ ์ฌ์ฉํ๊ณ ์์๋ค๋ ์ ์ ๋๋ค.
๋, airbnb ๋ฆฐํธ ์ค์ ์ ํ๊ธฐ ์ ์๋ eslint ์๋ฌ๊ฐ ์ ์์ ์ผ๋ก ํ์๋์๋ค๋ ์ (์ด๋ถ๋ turborepo ๊ธฐ๋ณธ๊ฐ์์๋ ์ ์์ ์ผ๋ก ๋์ํ๋ค๊ณ ํด์)
์์ ์ด์ ๋ฅผ ๋ฏธ๋ฃจ์ด๋ณด์ airbnb lint ์ค์ ๋ด์ง plugin๊ฐ์ ์ถฉ๋์ด ๋ฐ์ํ๊ณ ์์์ ์ ์ ์์์ต๋๋ค.
์๊ฐ์ด ๋๋ฉด ์ด๋ฅผ ๋ถ์ํด์ ๊ธฐ์ฌ๋ฅผ ์ข ํด๋ณด๊ณ ์ถ์๋ฐ.. ์ผ๋จ ํ๋ก์ ํธ ๊ฐ๋ฐ์ ๋๋ด๊ณ ์๊ฐํด๋ด์ผ๊ฒ ์ต๋๋ค.
MSW - Next๊ฐ์ ์ถฉ๋ ๋ฌธ์
API ๋ชจํน์ ํ๊ธฐ ์ํด ์ฌ์ ์ next ํ๋ก์ ํธ์์ msw ์ธํ ์ ํด์ฃผ์๋๋ฐ, ์ ํ๊ฒฝ์์ ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
โจฏ SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON at JSON.parse (<anonymous>) at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
โจฏ TypeError: Cannot read properties of null (reading 'useContext') at t.useContext (/Users/swarvy/Repository/attraction_fe/node_modules
์ผ๋จ ์์ ๋ด์ฉ๋ถํฐ ์ค๋ช ์ ๋๋ฆฌ๋ฉด, ์ ํฌ ํ๋ก์ ํธ์์๋ msw ์ธํ ์ server๋ง ์ธํ ํ๊ณ browser ์ธํ ์ ํ์ง ์์์ผ๋ฉฐ, ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ๋์ฑ ์ผ๋ก Next์ reWrite ๊ธฐ๋ฅ์ ์ฌ์ฉํ์ต๋๋ค.
์ผ์ข ์ ํ๋ก์ ๊ธฐ๋ฅ์ธ๋ฐ, ์ ๊ฐ ์๊ฐํ์ ๋ msw๋ ์์ฒญ์ด ๋ฐ์ํ๋ฉด ํด๋น ์์ฒญ์ ์ธํฐ์ ํธํ์ฌ ์๋ต์ ์ฃผ๋ ๊ฒ ์ด๊ธฐ ๋๋ฌธ์ ๋ณ๋์ ํ๋ก์๋ ํ์ํ์ง ์๋ค๊ณ ์๊ฐํ์ต๋๋ค.
๋, ์ ํ๊ฒฝ์์ MSW๋ก ํฅํ๋ api ์์ฒญ์ ํ๋ผ๋ฏธํฐ๊ฐ 2๋ฒ์ฉ ๋ค์ด๊ฐ๋ ๋ฌธ์ ๋ฅผ ๋ฐ๊ฒฌ, ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด reWrite ๊ธฐ๋ฅ์ ์ง์ฐ๊ณ ์คํ์ ์์ผฐ์ต๋๋ค.
reWrite๋ฅผ ํตํด ์คํ์์ผฐ์ ๋ ์ ์์ ์ผ๋ก ๋์ํ๋๊ฐ ์ถ์๋๋ ์์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉฐ ๊ฐํ์ ์ผ๋ก ํ์ด์ง ๋ ๋๋ง์ด ๋์ง ์๋ ๋ฌธ์ ๋ฅผ ํ์ธํ์ต๋๋ค.
์ด์๋ฅผ ํ์ธํด ๋ณธ ๊ฒฐ๊ณผ MSW์์ Next app router๋ฅผ ์๋ฒฝํ๊ฒ ์ง์ํ๊ณ ์์ง ์์ผ๋ฉฐ + ์ฌ์ฉํ๊ธฐ ์ํด์๋ browser worker์ server๋ฅผ ๋ชจ๋ ์ค์ ํด์ผ ํ๋ค๋ ๊ฒ ์ด์์ต๋๋ค.
์์ฝ๊ฒ๋ ์ ํฌ ํ๋ก์ ํธ๋ ํด๋น ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฌ์ฉํด๋ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์์ต๋๋ค.
๋ ํ๋ณด๊ณ ์ถ์์ง๋ง ์ ์ด์ MSW์์ ์์ง App router๋ฅผ ์ ์์ง์ํ์ง ์๊ณ ์์ผ๋ฉฐ, ์์ ๋ ์๋ฌ๋ Next ์์ฒด์ ์๋ฌ์ ๊ฐ๊น์ ๊ธฐ๋๋ฌธ์ ์ ํฌ ์์ค์์๋ ํด๊ฒฐ์ด ํ๋ค๋ค๊ณ ๋ณด์๊ณ ,
๋ฐฉ๋ฒ์ด ์๋ ๊ฒ ๊ฐ์ง ์์ง๋ง, ํ๋ก์ ํธ ์งํ์ค์ด๊ธฐ๋๋ฌธ์ msw์ ์ด ์ด์ ์๊ฐ์ด ๋ค์ด๊ฐ๋ค๋ฉด ์๋ ๊ฒ ๊ฐ์ ์ผ๋จ ํด๋น ๋ฌธ์ ๋ ๊ฑด๋๋ฐ๊ณ ๋ค์์ ์ฐพ์๋ณด๊ธฐ๋ก ํ์ต๋๋ค.
์ ๋ ์๋ ์ด์๋ฅผ ํ์ตํ ๋ค ๋ค์ ํ๋ก์ ํธ ๋ ์ ์ฉํด๋ณผ ์์ ์ ๋๋ค.
- TypeError: Cannot read properties of null reading 'useContext'
- Next.js Project Fails to Compile due to Package path ./browser is not exported from package /node_modules/msw
- Support Next.js 13 App Router
next lint๋ ๋ชจ๋๋ฅผ ๊ฒ์ฌํ์ง ์์
์์ lint ๋ฌธ์ ์ ์ฐ๊ณ๋๋ ์ฌํญ์ด์๋๋ฐ, next lint๋ฅผ ์ฐ์๋๋ฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง ์๋๊ฑธ ํ์ธํ์์๋ ๋ถ๊ตฌํ๊ณ eslint ์ปค๋งจ๋๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฆฐํธ ์๋ฌ๊ฐ ๋ฐ๊ฒฌ๋์์ต๋๋ค. ํด๋น ๋ด์ฉ์ ๋ํด์ ๋ ์ฐพ์๋ณธ ๊ฒฐ๊ณผ…
next lint์ ๊ฒฝ์ฐ์๋ ๊ธฐ๋ณธ์ ์ผ๋ก pages/, app/, components/, lib/, src/ ๋ง์ ๊ฒ์ฌํ๋ค๋ ๊ฒ ์ด์์ต๋๋ค.
ํด๋น ๋ด์ฉ์ ํ์ธํ๊ณ ์ปค๋งจ๋๋ฅผ ๋ณ๊ฒฝํ๋๋ ์ ์์ ์ผ๋ก eslint๋ฅผ ํตํด ๋ก์ง์ ๊ฒ์ฌํ ์ ์์์ต๋๋ค.
'๊ฐ๋ฐ > FRONTEND' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
Easyfetch ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ตฌํ๊ธฐ (0) | 2024.08.23 |
---|---|
Render Props๋ฅผ ํตํ UX ๊ฐ์ (1) | 2024.08.13 |
Next.js์์ S3 ์ ๋ก๋ (0) | 2024.08.09 |
์๋น์ค๋ฅผ ์ํ ๋ก์ง ์์ฑํ๊ธฐ (0) | 2024.08.06 |
Next.js์์ ์์ ํ ๋ก๊ทธ์ธ ๊ตฌํ ์ฌ์ (without NextAuth) (0) | 2024.07.10 |