Skip to content

Commit 497c359

Browse files
committed
added 404.html file after build step to handle gh-pages routing issues (5)
1 parent 8f5c61d commit 497c359

4 files changed

Lines changed: 14 additions & 8 deletions

File tree

.github/workflows/main.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,16 @@ jobs:
1919
with:
2020
node-version: 20.x
2121

22-
- name: Install and Build 🔧
23-
run: |
22+
- name: Install Dependencies 🔧
23+
run:
2424
yarn install
25+
26+
- name: Build 🔧
27+
run:
2528
yarn run build
29+
30+
- name: Post Build Actions 🛠️
31+
run:
2632
yarn run github-post-build
2733
env:
2834
NODE_ENV: production

github-post-build-script.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { cpSync } from 'fs';
2-
import vueConfig from './vite.config.js';
1+
import { cpSync, mkdirSync } from 'fs';
32

43
const routes = [
54
"/home",
@@ -10,8 +9,9 @@ const routes = [
109
"/privacy",
1110
];
1211

13-
const dir = vueConfig.build.outDir;
14-
console.log(dir)
12+
const dir = 'dist';
1513
for (const route of routes) {
16-
cpSync(dir + "/index.html", dir + route + "/index.html");
14+
const target = join(dir, route);
15+
mkdirSync(target, { recursive: true });
16+
cpSync(join(dir, 'index.html'), join(target, 'index.html'));
1717
}

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",

vite.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default defineConfig(({ command }) => {
1313
},
1414
},
1515
base: isDev ? "./" : "/solid-cockpit/",
16-
transpileDependencies: true,
1716
build: {
1817
outDir: "dist",
1918
},

0 commit comments

Comments
 (0)