Skip to content

Commit

Permalink
feat: setup alias
Browse files Browse the repository at this point in the history
  • Loading branch information
nxhawk committed Jan 24, 2025
1 parent 43586e1 commit 0623ba4
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 144 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dist-ssr
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
Expand Down
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.format": "explicit"
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
"@types/node": "^22.10.10",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"@typescript-eslint/eslint-plugin": "^7.15.0",
Expand Down
9 changes: 8 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import Home from "@/components/Home";

function App() {
return <div className="text-red-500 text-6xl text-center font-bold">React Boilerplate</div>;
return (
<div className="text-red-500 text-5xl text-center font-bold">
React Boilerplate
<Home />
</div>
);
}

export default App;
5 changes: 5 additions & 0 deletions src/components/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Home = () => {
return <div className="text-blue-500">Hello user</div>;
};

export default Home;
4 changes: 2 additions & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
import App from "@/App";
import "@/index.css";

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
},
"composite": true,
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
Expand All @@ -23,5 +27,5 @@
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
"include": ["src"],
}
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@
{
"path": "./tsconfig.node.json"
}
]
],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
}
}
}
13 changes: 6 additions & 7 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
base: "/",
plugins: [react()],
preview: {
port: 5173,
strictPort: true,
},
server: {
port: 5173,
strictPort: true,
host: true,
origin: "http://localhost:5173",
},
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
});
270 changes: 138 additions & 132 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 0623ba4

Please sign in to comment.