Skip to content

Commit

Permalink
feat: 상대 경로 설정 (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
adultlee authored Nov 6, 2023
1 parent 2cd35c0 commit 383fb3c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions FE/src/index.ts → FE/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import App from './App';
import App from '@/App';
import ReactDOM from 'react-dom/client';

const rootElement = document.getElementById('root');
if (rootElement) {
const root = ReactDOM.createRoot(rootElement);
root.render(App());
root.render(<App />);
} else {
console.error('Root element not found');
}
11 changes: 10 additions & 1 deletion FE/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
"jsx": "react-jsx",
"jsxImportSource": "@emotion/react",
"strict": true,
"noImplicitAny": true
"noImplicitAny": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@components/*": ["./src/components/*"],
"@common/*": ["./src/components/common/*"],
"@foundation/*": ["./src/components/foundation/*"],
"@page/*": ["./src/page/*"],
"@constants/*": ["./src/constants/*"]
}
},
"include": ["src"]
}
18 changes: 14 additions & 4 deletions FE/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const webpack = require('webpack');
module.exports = {
mode: process.env.production === 'true' ? 'production' : 'development',
devtool: process.env.production === 'true' ? 'hidden-source-map' : 'eval',
entry: './src/index.ts',
entry: './src/index.tsx',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
Expand All @@ -17,6 +17,19 @@ module.exports = {
hot: true,
static: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
alias: {
// src 폴더를 '@' 별칭으로 설정
'@': path.resolve(__dirname, 'src/'),
'@components': path.resolve(__dirname, 'src/components/'),
'@common': path.resolve(__dirname, 'src/components/common/'),
'@foundation': path.resolve(__dirname, 'src/components/foundation/'),
'@page': path.resolve(__dirname, 'src/page/'),
'@constants': path.resolve(__dirname, 'src/constants/'),
},
},

plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
Expand Down Expand Up @@ -46,7 +59,4 @@ module.exports = {
},
],
},
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx'],
},
};

0 comments on commit 383fb3c

Please sign in to comment.