Skip to content

Commit

Permalink
chore: use root path
Browse files Browse the repository at this point in the history
  • Loading branch information
rsmelo92 committed Jan 27, 2024
1 parent 65e3c8e commit 9a3f5a4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
1 change: 0 additions & 1 deletion .env

This file was deleted.

9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# Portfolio

Built with Vite and React

To run the projects just run:

```
yarn
yarn dev
```
9 changes: 6 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ import Root from "@/routes/Root";
import { Main } from "@/routes/Main";
import { Projects } from "@/routes/Projects";

const { BASE_URL } = import.meta.env
console.log(import.meta.env);

const router = createBrowserRouter([
{
path: "/portfolio2.0/",
path: BASE_URL,
element: <Root />,
children: [
{
path: "/portfolio2.0/",
path: BASE_URL,
element: <Main />,
},
{
path: "/portfolio2.0/projects",
path: `${BASE_URL}/projects`,
element: <Projects />,
},
],
Expand Down
20 changes: 7 additions & 13 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import path from 'path'
import { defineConfig, loadEnv } from 'vite'
import { defineConfig } from 'vite'

import react from '@vitejs/plugin-react-swc'

// https://vitejs.dev/config/
export default defineConfig(({ mode}) => {
const env = loadEnv(mode, process.cwd(), '')
return ({
base: env.ROOT_PATH,
plugins: [react()],
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
},
define: {
ROOT_PATH: JSON.stringify(env.ROOT_PATH)
},
})
export default defineConfig({
base: "/",
plugins: [react()],
resolve: {
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }],
},
})

0 comments on commit 9a3f5a4

Please sign in to comment.