Skip to content

Commit

Permalink
Env: 절대경로를 인식하지 못하는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunaeri committed Sep 20, 2024
1 parent a53ff8b commit d53aa81
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createRoot } from 'react-dom/client';

import App from './App.tsx';
import App from '@/App';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';

const queryClient = new QueryClient();
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"composite": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",

/* Linting */
Expand Down
14 changes: 13 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
"@/*": ["src/*"],
"@/components/*": ["src/components/*"],
"@/pages/*": ["src/pages/*"],
"@/apis/*": ["src/apis/*"],
"@/hooks/*": ["src/hooks/*"],
"@/store/*": ["src/store/*"],
"@/utils/*": ["src/utils/*"],
"@/assets/*": ["src/assets/*"],
"@/constants/*": ["src/constants/*"],
"@/config/*": ["src/config/*"],
"@/mocks/*": ["src/mocks/*"],
"@/styles/*": ["src/styles/*"]
}
},
"files": [],
"include": ["src"],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
Expand Down
3 changes: 1 addition & 2 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
"composite": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,

/* Linting */
"strict": true,
Expand Down
32 changes: 20 additions & 12 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,25 @@ import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@/components': path.resolve(__dirname, 'src/components'),
'@/pages': path.resolve(__dirname, 'src/pages'),
'@/apis': path.resolve(__dirname, 'src/apis'),
'@/hooks': path.resolve(__dirname, 'src/hooks'),
'@/store': path.resolve(__dirname, 'src/store'),
'@/utils': path.resolve(__dirname, 'src/utils'),
'@/assets': path.resolve(__dirname, 'src/assets'),
'@/constants': path.resolve(__dirname, 'src/constants'),
'@/config': path.resolve(__dirname, 'src/config'),
'@/styles': path.resolve(__dirname, 'src/styles'),
},
alias: [
{ find: '@/', replacement: path.resolve(__dirname, 'src') },
{
find: '@/components',
replacement: path.resolve(__dirname, 'src/components'),
},
{ find: '@/pages', replacement: path.resolve(__dirname, 'src/pages') },
{ find: '@/apis', replacement: path.resolve(__dirname, 'src/apis') },
{ find: '@/hooks', replacement: path.resolve(__dirname, 'src/hooks') },
{ find: '@/store', replacement: path.resolve(__dirname, 'src/store') },
{ find: '@/utils', replacement: path.resolve(__dirname, 'src/utils') },
{ find: '@/assets', replacement: path.resolve(__dirname, 'src/assets') },
{
find: '@/constants',
replacement: path.resolve(__dirname, 'src/constants'),
},
{ find: '@/config', replacement: path.resolve(__dirname, 'src/config') },
{ find: '@/mocks', replacement: path.resolve(__dirname, 'src/mocks') },
{ find: '@/styles', replacement: path.resolve(__dirname, 'src/styles') },
],
},
});

0 comments on commit d53aa81

Please sign in to comment.