Skip to content

Commit f9e5c7a

Browse files
committed
fix(ci): fix base href when build gh-pages
1 parent c4da0ba commit f9e5c7a

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: npm ci
3434

3535
- name: Build all projects
36-
run: npm run build:all
36+
run: npm run build:all:gh-pages
3737

3838
- name: Copy all built files to deploy folder
3939
run: |

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"serve:template-editor": "cd dist/template-editor && npx serve -l 4202 --cors",
1616

1717
"build:all": "concurrently \"npm run build:shell\" \"npm run build:first-mf\" \"npm run build:template-editor\"",
18-
"serve:all": "concurrently \"npm run serve:shell\" \"npm run serve:first-mf\" \"npm run serve:template-editor\""
18+
"serve:all": "concurrently \"npm run serve:shell\" \"npm run serve:first-mf\" \"npm run serve:template-editor\"",
19+
20+
"build:all:gh-pages": "concurrently \"ng build shell --base-href /mfe-angular/shell/\" \"ng build first-mf --base-href /mfe-angular/first-mf/\" \"cd projects/template-editor && vite build --mode gh-pages\""
1921
},
2022
"private": true,
2123
"dependencies": {

projects/template-editor/vite.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ const __filename = fileURLToPath(import.meta.url)
1010
const __dirname = path.dirname(__filename)
1111

1212
// https://vite.dev/config/
13-
export default defineConfig({
13+
export default defineConfig(({ mode }) => ({
14+
base: mode === 'gh-pages' ? '/mfe-angular/template-editor/' : '/',
1415
plugins: [
1516
vue(),
1617
vueDevTools(),
@@ -38,4 +39,4 @@ export default defineConfig({
3839
emptyOutDir: true,
3940
chunkSizeWarningLimit: 10000,
4041
}
41-
})
42+
}))

0 commit comments

Comments
 (0)