Skip to content

Commit bdb2a82

Browse files
authored
Merge pull request #60 from KNowledgeOnWebScale/EDC_active
added 404.html file after build step to handle gh-pages routing issue…
2 parents 1edab0c + cb33742 commit bdb2a82

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

main.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ permissions:
99
jobs:
1010
build-and-deploy:
1111
runs-on: ubuntu-latest
12-
env:
13-
VITE_BASE_URL: /solid-cockpit/
12+
1413
steps:
1514
- name: Checkout 🛎️
1615
uses: actions/checkout@v3
@@ -20,12 +19,15 @@ jobs:
2019
with:
2120
node-version: 20.x
2221
cache: npm
22+
2323
- name: Install and Build 🔧
2424
run: |
2525
yarn i
26-
yarn run build
27-
cd dist
28-
cp index.html 404.html
26+
yarn run build --base=/solid-cockpit/
27+
28+
- name: Add 404 fallback
29+
run: cp dist/index.html dist/404.html
30+
2931
- name: Deploy 🚀
3032
uses: JamesIves/github-pages-deploy-action@releases/v4
3133
with:

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"repository": "https://github.com/KNowledgeOnWebScale/solid-cockpit/tree/EDC_active",
88
"author": "Elias Crum",
99
"license": "MIT",
10+
"type": "module",
1011
"scripts": {
1112
"dev": "vite",
1213
"build": "vite build",

src/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useAuthStore } from "./stores/auth";
1515
* The router here allows for navigation between different functional pages of the TRIPLE App
1616
*/
1717
const router = createRouter({
18-
history: createWebHistory('/solid-cockpit/'),
18+
history: createWebHistory(import.meta.env.BASE_URL),
1919
routes: [
2020
{
2121
name: "Home",

vite.config.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1-
import { defineConfig } from 'vite'
2-
import vue from '@vitejs/plugin-vue'
3-
import { fileURLToPath, URL } from 'node:url'
4-
1+
import { defineConfig } from "vite";
2+
import vue from "@vitejs/plugin-vue";
3+
import { fileURLToPath, URL } from "node:url";
54

65
// https://vitejs.dev/config/
7-
export default defineConfig({
8-
plugins: [vue()],
9-
resolve: {
10-
alias: {
11-
'@': fileURLToPath(new URL('./src', import.meta.url))
12-
}
13-
},
14-
base: process.env.VITE_BASE_URL || './',
15-
transpileDependencies: true,
16-
build: {
17-
outDir: 'dist',
18-
},
19-
server: {
20-
headers: {
21-
'Cross-Origin-Opener-Policy': 'same-origin',
22-
'Cross-Origin-Embedder-Policy': 'require-corp',
6+
export default defineConfig(({ command }) => {
7+
const isDev = command === "serve";
8+
return {
9+
plugins: [vue()],
10+
resolve: {
11+
alias: {
12+
"@": fileURLToPath(new URL("./src", import.meta.url)),
13+
},
14+
},
15+
base: isDev ? "./" : "/solid-cockpit/",
16+
transpileDependencies: true,
17+
build: {
18+
outDir: "dist",
19+
},
20+
server: {
21+
headers: {
22+
"Cross-Origin-Opener-Policy": "same-origin",
23+
"Cross-Origin-Embedder-Policy": "require-corp",
24+
},
2325
},
24-
},
25-
})
26+
};
27+
});

0 commit comments

Comments
 (0)