Skip to content

Commit 5a0e897

Browse files
committed
Fix
1 parent cd0fd66 commit 5a0e897

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: npm ci
2222

2323
- name: Build 🔧
24-
run: npm run build
24+
run: NODE_ENV=production npm run build
2525

2626
- name: Create .nojekyll file 📄
2727
run: touch dist/.nojekyll

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="icon" type="image/svg+xml" href="/hxndev.github.io/vite.svg" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>Hassan Shahzad | Portfolio</title>
88
<!-- Script for handling client-side routing on GitHub Pages -->
@@ -24,6 +24,6 @@
2424
</head>
2525
<body>
2626
<div id="root"></div>
27-
<script type="module" src="/hxndev.github.io/src/main.jsx"></script>
27+
<script type="module" src="/src/main.jsx"></script>
2828
</body>
2929
</html>

vite.config.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ import { defineConfig } from 'vite';
22
import react from '@vitejs/plugin-react';
33
import path from 'path';
44

5+
// Determine if we're in production mode (GitHub Pages deployment)
6+
const isProduction = process.env.NODE_ENV === 'production';
7+
58
// https://vitejs.dev/config/
69
export default defineConfig({
710
plugins: [react()],
811

9-
// For GitHub Pages deployment
10-
base: '/hxndev.github.io/', // Use your repository name
12+
// Use different base paths for development and production
13+
base: isProduction ? '/hxndev.github.io/' : '/',
1114

1215
build: {
1316
outDir: 'dist',
@@ -45,8 +48,8 @@ export default defineConfig({
4548
include: ['react', 'react-dom', '@mantine/core', 'gsap'],
4649
},
4750

48-
// Ensure proper MIME types for JavaScript modules
49-
esbuild: {
50-
jsxInject: `import React from 'react'`,
51-
},
51+
// Remove the jsxInject configuration
52+
// esbuild: {
53+
// jsxInject: `import React from 'react'`,
54+
// },
5255
});

0 commit comments

Comments
 (0)