๊ด€๋ฆฌ ๋ฉ”๋‰ด

Wookang makes AI

[Nuxt3] Cannot find module '??.json' or its corresponding type declarations.ts-plugin(2307) ํ•ด๊ฒฐํ•˜๊ธฐ ๋ณธ๋ฌธ

Developments/Nuxt3

[Nuxt3] Cannot find module '??.json' or its corresponding type declarations.ts-plugin(2307) ํ•ด๊ฒฐํ•˜๊ธฐ

ํ‘ธ๋ฅธ๊นƒ๋ฐœ๐Ÿณ๏ธ 2025. 5. 4. 13:25

์ƒํ™ฉ: ์•„๋ž˜์™€ ๊ฐ™์ด ์ง์ ‘ jsonํŒŒ์ผ์„ ๊ฐ€์ ธ์˜ฌ๋•Œ ๊ฒฝ๊ณ ๊ฐ€ ๋œฌ๋‹ค. ํ•˜์ง€๋งŒ ๋ฐ์ดํ„ฐ๋Š” ์ •์ƒ์ ์œผ๋กœ ๊ฐ€์ ธ์˜ค๊ณ  ์žˆ๋‹ค. 

import faqCategoryList from './public/data/faq_category.json';

 

์ฆ์ƒ: Cannot find module '??.json' or its corresponding type declarations.ts-plugin(2307)

 

ํ•ด๊ฒฐ: ๋ฃจํŠธํด๋”์— types.d.tsํŒŒ์ผ์„ ์ƒ์„ฑํ•œํ›„ ์•„๋ž˜์ฒ˜๋Ÿผ json๋ชจ๋“ˆ์„ ๋ช…์‹œ์ ์œผ๋กœ ์„ ์–ธํ•ด์ค€๋‹ค

declare module "*.json" {
  const value: any;
  export default value;
}