Skip to content

Commit a817a9a

Browse files
committed
update 03
1 parent 66ec001 commit a817a9a

37 files changed

Lines changed: 4854 additions & 2691 deletions

07-cloud/01-basic/03-github-branch/README.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ git commit -m "upload files"
5050
git push -u origin gh-pages
5151
```
5252

53+
> Check Github Actions tab to see the deployment process.
54+
>
55+
> Check Github repository > Settings tab > Pages section.
56+
5357
Now, we have deployed our website in: `https://<user-name>.github.io/<repository-name>`:
5458

5559
![01-open-gh-pages-url](./readme-resources/01-open-gh-pages-url.png)
@@ -71,10 +75,8 @@ This issue is related with the references to assets in the `index.html` file. We
7175
<title>Cloud Module</title>
7276

7377
<meta name="viewport" content="width=device-width, initial-scale=1" />
74-
- <script type="module" crossorigin src="/assets/index-a824b72f.js"></script>
75-
- <link rel="modulepreload" crossorigin href="/assets/vendor-13e230a0.js">
76-
+ <script type="module" crossorigin src="./assets/index-a824b72f.js"></script>
77-
+ <link rel="modulepreload" crossorigin href="./assets/vendor-13e230a0.js">
78+
- <script type="module" crossorigin src="/assets/index-CBHDhUW6.js"></script>
79+
+ <script type="module" crossorigin src="./assets/index-CBHDhUW6.js"></script>
7880
</head>
7981
<body>
8082
<div id="root"></div>
@@ -97,9 +99,7 @@ Update config:
9799
_./vite.config.js_
98100

99101
```diff
100-
import { defineConfig, splitVendorChunkPlugin } from 'vite';
101-
import react from '@vitejs/plugin-react';
102-
import { fileURLToPath } from 'node:url';
102+
...
103103

104104
export default defineConfig({
105105
+ base: './',
@@ -109,6 +109,26 @@ export default defineConfig({
109109

110110
> [Vite Public base path](https://vitejs.dev/guide/build.html#public-base-path)
111111
112+
And configure `hash history` in the router:
113+
114+
_./src/core/router/router.ts_
115+
116+
```diff
117+
- import { createRouter } from '@tanstack/react-router';
118+
+ import { createRouter, createHashHistory } from '@tanstack/react-router';
119+
// The route-tree file is generated automatically. Do not modify this file manually.
120+
import { routeTree } from './route-tree';
121+
122+
+ const history = createHashHistory();
123+
124+
export const router = createRouter({
125+
routeTree,
126+
+ history,
127+
});
128+
...
129+
130+
```
131+
112132
Run build command:
113133

114134
```bash
@@ -118,13 +138,22 @@ npm run build
118138

119139
```
120140

141+
Commit and push in `main` branch:
142+
143+
```bash
144+
git add .
145+
git commit -m "update base path"
146+
git push
147+
148+
```
149+
121150
Copy `dist` folder to `gh-pages` branch as above.
122151

123-
Commit and push:
152+
Commit and push in `gh-pages` branch:
124153

125154
```bash
126155
git add .
127-
git commit -m "upload files with base path"
156+
git commit -m "update base path"
128157
git push
129158

130159
```

0 commit comments

Comments
 (0)