Skip to content

Commit

Permalink
Config: #3 TS config & Vite config에 절대 경로 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Seok93 committed May 17, 2024
1 parent 661f7df commit 433c275
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,25 @@
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,

/* Path */
"baseUrl": ".",
"paths": {
"@/*": ["src/*"],
"@assets/*": ["src/assets/*"],
"@common/*": ["src/common/*"],
"@components/*": ["src/components/*"],
"@constants/*": ["src/constants/*"],
"@hooks/*": ["src/hooks/*"],
"@layouts/*": ["src/layouts/*"],
"@mocks/*": ["src/mocks/*"],
"@pages/*": ["src/pages/*"],
"@services/*": ["src/services/*"],
"@stories/*": ["src/stories/*"],
"@utils/*": ["src/utils/*"]
}
},
"include": ["src"],
"include": ["src", "vitest.setup.ts", "vite.config.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
17 changes: 17 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import path from 'path';

export default defineConfig({
plugins: [react()],
Expand All @@ -10,4 +11,20 @@ export default defineConfig({
setupFiles: './vitest.setup.ts',
css: true,
},
resolve: {
alias: [
{ find: '@', replacement: path.resolve(__dirname, 'src') },
{ find: '@assets', replacement: path.resolve(__dirname, 'src/assets') },
{ find: '@common', replacement: path.resolve(__dirname, 'src/common') },
{ find: '@components', replacement: path.resolve(__dirname, 'src/components') },
{ find: '@constants', replacement: path.resolve(__dirname, 'src/constants') },
{ find: '@hooks', replacement: path.resolve(__dirname, 'src/hooks') },
{ find: '@layouts', replacement: path.resolve(__dirname, 'src/layouts') },
{ find: '@mocks', replacement: path.resolve(__dirname, 'src/mocks') },
{ find: '@pages', replacement: path.resolve(__dirname, 'src/pages') },
{ find: '@services', replacement: path.resolve(__dirname, 'src/services') },
{ find: '@stories', replacement: path.resolve(__dirname, 'src/stories') },
{ find: '@utils', replacement: path.resolve(__dirname, 'src/utils') },
],
},
});

0 comments on commit 433c275

Please sign in to comment.