diff --git a/jest.config.js b/jest.config.js index ef58d847..4914ed0a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,6 +3,13 @@ export default { testEnvironment: 'jsdom', testMatch: ['**/src/**/*.{spec,test}.{js,jsx,ts,tsx}'], moduleNameMapper: { - '^@/(.*)': '/src/$1', + '^@type/(.*)$': '/src/@types/$1', + '^@components/(.*)$': '/src/components/$1', + '^@constants/(.*)$': '/src/constants/$1', + '^@styles/(.*)$': '/src/styles/$1', + '^@utils/(.*)$': '/src/utils/$1', + '^@hooks/(.*)$': '/src/hooks/$1', + '^@pages/(.*)$': '/src/pages/$1', + '^@assets/(.*)$': '/public/assets/$1', }, }; diff --git a/src/App.tsx b/src/App.tsx index 0037cca3..d804264d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,7 +10,7 @@ const App = () => { } /> } /> } /> - } /> + } /> ); }; diff --git a/src/components/Image/index.tsx b/src/components/Image/index.tsx index 5cc24e02..85af970e 100644 --- a/src/components/Image/index.tsx +++ b/src/components/Image/index.tsx @@ -1,7 +1,7 @@ import styled from '@emotion/styled'; +import { Size, SizeOption } from '@type/styles/size'; import { setSize } from '@utils/styles/size'; -import React, { CSSProperties } from 'react'; -import { Size, SizeOption } from 'src/@types/styles/size'; +import { CSSProperties } from 'react'; type ImageSize = { [key in SizeOption]: Size; diff --git a/src/utils/styles/size.ts b/src/utils/styles/size.ts index bf79f802..c88a8e1a 100644 --- a/src/utils/styles/size.ts +++ b/src/utils/styles/size.ts @@ -1,4 +1,4 @@ -import { Size } from 'src/@types/styles/size'; +import { Size } from '@type/styles/size'; export function setSize(heigth: number): Size; export function setSize(height: number, width?: number): Size; diff --git a/tsconfig.path.json b/tsconfig.path.json index 61966976..52bc21e1 100644 --- a/tsconfig.path.json +++ b/tsconfig.path.json @@ -2,6 +2,7 @@ "compilerOptions": { "baseUrl": ".", "paths": { + "@type/*": ["./src/@types/*"], "@components/*": ["./src/components/*"], "@constants/*": ["./src/constants/*"], "@styles/*": ["./src/styles/*"], diff --git a/vite.config.ts b/vite.config.ts index ff745376..fbdc2d2b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,6 +9,10 @@ export default defineConfig({ plugins: [react(), tsconfigPaths()], resolve: { alias: [ + { + find: '@type', + replacement: resolve(__dirname, './src/@types'), + }, { find: '@components', replacement: resolve(__dirname, './src/components'),