Skip to content

Commit e5f565d

Browse files
Deploy production build to main branch docs folder
1 parent 2630de5 commit e5f565d

4 files changed

Lines changed: 26 additions & 6 deletions

File tree

index.local.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<title>Vite + React</title>
8+
<link
9+
rel="stylesheet"
10+
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css"
11+
/>
12+
</head>
13+
<body>
14+
<div id="root"></div>
15+
<script type="module" src="/src/main.jsx"></script>
16+
</body>
17+
</html>

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
"type": "module",
66
"homepage": "https://darshankumargp.github.io/CodeVerse/",
77
"scripts": {
8-
"dev": "vite",
8+
"dev": "copy index.local.html index.html && vite",
99
"build": "vite build",
1010
"lint": "eslint .",
1111
"preview": "vite preview",
1212
"predeploy": "npm run build",
13-
"deploy": "gh-pages -d dist"
13+
"prepare-deploy": "copy dist\\index.html index.html",
14+
"deploy": "npm run prepare-deploy && gh-pages -d dist"
1415
},
1516
"dependencies": {
1617
"framer-motion": "^12.23.6",

src/main.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom/client'
3-
import { HashRouter } from 'react-router-dom' // <-- change here
3+
import { HashRouter } from 'react-router-dom'
44
import App from './App.jsx'
55
import './index.css'
66

vite.config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import { defineConfig } from 'vite'
22
import react from '@vitejs/plugin-react'
33

4-
export default defineConfig({
5-
plugins: [react()],
6-
base: '/CodeVerse/',
4+
export default defineConfig(({ command }) => {
5+
return {
6+
plugins: [react()],
7+
base: command === 'build' ? './' : '/',
8+
}
79
})

0 commit comments

Comments
 (0)