🔎 절대 경로
절대 경로와 관련 된 설정은 /craco.config.js
, /tsconfig.paths.json
파일에 위치합니다.
const path = require('path');
module.exports = {
webpack: {
alias: {
'@apis': path.resolve(__dirname, 'src/apis'),
'@components': path.resolve(__dirname, 'src/components'),
'@constants': path.resolve(__dirname, 'src/constants'),
'@hooks': path.resolve(__dirname, 'src/hooks'),
'@pages': path.resolve(__dirname, 'src/pages'),
'@states': path.resolve(__dirname, 'src/states'),
'@styles': path.resolve(__dirname, 'src/styles'),
'@utils': path.resolve(__dirname, 'src/utils'),
},
},
};
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@apis": ["./apis/index.ts"],
"@apis/*": ["./apis/*"],
"@components": ["./components/index.ts"],
"@components/*": ["./components/*"],
"@constants": ["./constants/index.ts"],
"@constants/*": ["./constants/*"],
"@hooks": ["./hooks/index.ts"],
"@hooks/*": ["./hooks/*"],
"@pages": ["./pages/index.ts"],
"@pages/*": ["./pages/*"],
"@states": ["./states/index.ts"],
"@states/*": ["./states/*"],
"@styles": ["./styles/index.ts"],
"@styles/*": ["./styles/*"],
"@utils": ["./utils/index.ts"],
"@utils/*": ["./utils/*"]
}
}
}
제가 주로 사용하는 구조에 맞게 @xxx
형태로 절대 경로를 설정해 주었으며, tsconfig에는 폴더 인덱스까지 적용되어 있습니다.
만약 다른 구조를 사용한다면 두 파일에서 수정하시면 됩니다.
🔎 .prettierrc
{
"Semicolons": true,
"singleQuote": true,
"trailingComma": "all",
"Tabs": true,
"tabWidth": 2,
"printWidth": 140
}
입맛에 맞게 수정하시면 됩니다.