Commit
·
838b604
1
Parent(s):
23c0171
feat: add multi-platform deployment configuration
Browse files- package.json +9 -1
- src/App.tsx +5 -1
- vite.config.ts +24 -16
package.json
CHANGED
@@ -2,15 +2,23 @@
|
|
2 |
"name": "react-vite-ui",
|
3 |
"private": true,
|
4 |
"homepage": "https://sheer-8kp.pages.dev/",
|
|
|
|
|
|
|
|
|
|
|
5 |
"version": "0.0.1",
|
6 |
"type": "module",
|
7 |
"scripts": {
|
8 |
"dev": "vite",
|
9 |
"build": "tsc -b && vite build",
|
|
|
10 |
"lint": "eslint .",
|
11 |
"preview": "vite preview",
|
12 |
"predeploy": "bun run build",
|
13 |
-
"deploy": "bun run build && npx wrangler pages deploy dist"
|
|
|
|
|
14 |
},
|
15 |
"dependencies": {
|
16 |
"@clerk/clerk-react": "^5.23.0",
|
|
|
2 |
"name": "react-vite-ui",
|
3 |
"private": true,
|
4 |
"homepage": "https://sheer-8kp.pages.dev/",
|
5 |
+
"deployments": [
|
6 |
+
"https://sheer-8kp.pages.dev/",
|
7 |
+
"https://mantrakp04.github.io/sheer",
|
8 |
+
"https://huggingface.co/spaces/mantrakp/sheer"
|
9 |
+
],
|
10 |
"version": "0.0.1",
|
11 |
"type": "module",
|
12 |
"scripts": {
|
13 |
"dev": "vite",
|
14 |
"build": "tsc -b && vite build",
|
15 |
+
"build:github": "tsc -b && vite build --mode github",
|
16 |
"lint": "eslint .",
|
17 |
"preview": "vite preview",
|
18 |
"predeploy": "bun run build",
|
19 |
+
"deploy": "bun run build && npx wrangler pages deploy dist",
|
20 |
+
"deploy:gh-pages": "bun run build:github && gh-pages -d dist",
|
21 |
+
"deploy:all": "bun run deploy && bun run deploy:gh-pages"
|
22 |
},
|
23 |
"dependencies": {
|
24 |
"@clerk/clerk-react": "^5.23.0",
|
src/App.tsx
CHANGED
@@ -9,11 +9,15 @@ import { HuggingFaceCallback } from "./pages/integrations/huggingface-callback";
|
|
9 |
|
10 |
function App() {
|
11 |
const queryClient = new QueryClient();
|
|
|
|
|
|
|
|
|
12 |
|
13 |
return (
|
14 |
<QueryClientProvider client={queryClient}>
|
15 |
<LoadingProvider>
|
16 |
-
<BrowserRouter>
|
17 |
<Routes>
|
18 |
{routes.map((route) => (
|
19 |
<Route
|
|
|
9 |
|
10 |
function App() {
|
11 |
const queryClient = new QueryClient();
|
12 |
+
|
13 |
+
// Get the base URL from Vite's import.meta.env
|
14 |
+
// This will be set based on the `base` option in vite.config.ts
|
15 |
+
const basename = import.meta.env.BASE_URL;
|
16 |
|
17 |
return (
|
18 |
<QueryClientProvider client={queryClient}>
|
19 |
<LoadingProvider>
|
20 |
+
<BrowserRouter basename={basename}>
|
21 |
<Routes>
|
22 |
{routes.map((route) => (
|
23 |
<Route
|
vite.config.ts
CHANGED
@@ -3,23 +3,31 @@ import react from "@vitejs/plugin-react";
|
|
3 |
import { resolve } from "path";
|
4 |
|
5 |
// https://vitejs.dev/config/
|
6 |
-
export default defineConfig({
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
},
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
}
|
23 |
}
|
24 |
-
}
|
25 |
});
|
|
|
3 |
import { resolve } from "path";
|
4 |
|
5 |
// https://vitejs.dev/config/
|
6 |
+
export default defineConfig(({ mode }) => {
|
7 |
+
// Default base is '/' which works for most cases
|
8 |
+
// When deploying to GitHub Pages, we need to use the repo name as the base
|
9 |
+
// For Cloudflare Pages and HuggingFace, '/' works fine
|
10 |
+
const base = mode === 'github' ? '/sheer/' : '/';
|
11 |
+
|
12 |
+
return {
|
13 |
+
base,
|
14 |
+
build: {
|
15 |
+
target: "esnext",
|
16 |
+
},
|
17 |
+
plugins: [react()],
|
18 |
+
resolve: {
|
19 |
+
alias: {
|
20 |
+
"@": resolve(__dirname, "./src"),
|
21 |
+
},
|
22 |
},
|
23 |
+
server: {
|
24 |
+
proxy: {
|
25 |
+
'http://localhost:11434': {
|
26 |
+
target: 'http://localhost:11434',
|
27 |
+
changeOrigin: true,
|
28 |
+
secure: false,
|
29 |
+
}
|
30 |
}
|
31 |
}
|
32 |
+
};
|
33 |
});
|