๐ต๏ธ ์ด์
scss๋ก ๋ฒํผ ๋ง๋ค์ด๋ณด๊ธฐ ์ค..๋ค์๊ณผ ๊ฐ์ ts ๊ฒฝ๊ณ ๊ฐ ๋ด๋ค.
๋ฌธ์ ๋ ts์ tsx ํ์ฅ์๋ก ๋๋ด์ผ๋ง ๋ชจ๋๋ก ์ธ์ํด์ scss ํ์ฅ์์ ํ์ผ์ ์ธ์ํ์ง ๋ชปํ ๊ฑฐ์๋ค.
๐ ํด๊ฒฐ
1. tsconfig.ts ์ ๊ฐ์ ์ต์๋จ ๊ฒฝ๋ก์ typings ํด๋๋ฅผ ๋ง๋ค์ด์ฃผ์.
2. typings/ ํด๋ ๋ด์ declarations.d.ts ํ์ผ์ ๋ง๋ค์ด์ฃผ๊ณ ๋ค์์ ์ฝ๋ ์์ฑ.
declare module "*.scss" {
const content: Record<string, string>;
export default content;
}
3. tsconfig.ts ์ typings ํด๋ ์ถ๊ฐํด์ฃผ๊ธฐ
{
"extends": "@repo/typescript-config/react-library.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["typings", "src"], // typings ์ถ๊ฐ
"exclude": ["node_modules", "dist"]
}
๐ References
https://stackoverflow.com/questions/72701371/cannot-find-module-src-styles-scss
Cannot find module "@src/styles.scss"
I import the style file in my project like this: import styles from '@src/styles.scss'; The tsconfig.json file contains: { "compilerOptions": { "module": "CommonJS&quo...
stackoverflow.com