Parcourir la source

[demo]Modify svelte kit for github page

dufu1991 il y a 2 ans
Parent
commit
87ec6c9225
2 fichiers modifiés avec 6 ajouts et 4 suppressions
  1. 2 0
      demo/.github/workflows/releases-demo.yml
  2. 4 4
      demo/svelte.config.js

+ 2 - 0
demo/.github/workflows/releases-demo.yml

@@ -37,6 +37,8 @@ jobs:
           node-version: 20.x
           cache: 'npm'
       - name: Install dependencies and build
+        env:
+          BASE_PATH: '/${{ github.event.repository.name }}'
         run: |
           npm ci
           npm run build

+ 4 - 4
demo/svelte.config.js

@@ -11,10 +11,10 @@ const config = {
 			// 可能因主机而异
 			fallback: 'index.html',
 		}),
-		// paths: {
-		// 	// @ts-ignore
-		// 	base: process.argv.includes('dev') ? '' : process.env.BASE_PATH,
-		// },
+		paths: {
+			// @ts-ignore
+			base: process.argv.includes('dev') ? '' : process.env.BASE_PATH,
+		},
 	},
 	onwarn: (warning, handler) => {
 		if (warning.code.startsWith('a11y-')) {