Skip to content

Commit

Permalink
feat(client-config): add path aliases (#14)
Browse files Browse the repository at this point in the history
Closes #4
  • Loading branch information
IdoBouskila authored Nov 29, 2024
1 parent 7260cae commit 5195a6d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 8 deletions.
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"devDependencies": {
"@eslint/js": "^9.13.0",
"@types/leaflet": "^1.9.14",
"@types/node": "^22.10.1",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
Expand Down
6 changes: 3 additions & 3 deletions client/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import './App.css';
import tabs from '@utils/tabs';
import { useState } from 'react';
import tabs from './components/utils/tabs';
import Dashboard from './components/dashboard';
import SideNavigation from './components/side-navigation';
import Dashboard from '@components/dashboard';
import SideNavigation from '@components/side-navigation';

function App() {
const [currentTabId, setCurrentTabId] = useState(tabs[0].id);
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/side-navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tabs from './utils/tabs';
import tabs from '@utils/tabs';
import { RxGithubLogo } from 'react-icons/rx';

const SideNavigation: React.FC<{
Expand Down
File renamed without changes.
9 changes: 8 additions & 1 deletion client/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,

"baseUrl": ".",
"paths": {
"@components/*": ["src/components/*"],
"@utils/*": ["src/utils/*"],
"@hooks/*": ["src/hooks/*"],
"@server/*": ["../server/*"]
},

/* Bundler mode */
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
Expand Down
15 changes: 12 additions & 3 deletions client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@components': path.resolve(__dirname, 'src/components'),
'@utils': path.resolve(__dirname, 'src/utils'),
'@hooks': path.resolve(__dirname, 'src/hooks'),
'@server': path.resolve(__dirname, '../server'),
},
},
build: {
rollupOptions: {
external: ['leaflet'],
},
},
})
});
12 changes: 12 additions & 0 deletions client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,13 @@
dependencies:
"@types/geojson" "*"

"@types/node@^22.10.1":
version "22.10.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.10.1.tgz#41ffeee127b8975a05f8c4f83fb89bcb2987d766"
integrity sha512-qKgsUwfHZV2WCWLAnVP1JqnpE6Im6h3Y0+fYgMTasNQ7V++CBX5OT1as0g0f+OyubbFqhf6XVNIsmN4IIhEgGQ==
dependencies:
undici-types "~6.20.0"

"@types/normalize-package-data@^2.4.0":
version "2.4.4"
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901"
Expand Down Expand Up @@ -1897,6 +1904,11 @@ typescript@~5.6.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b"
integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==

undici-types@~6.20.0:
version "6.20.0"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.20.0.tgz#8171bf22c1f588d1554d55bf204bc624af388433"
integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==

update-browserslist-db@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5"
Expand Down

0 comments on commit 5195a6d

Please sign in to comment.